Skip to content

Commit b284d3c

Browse files
author
Felipe Zimmerle
committed
Small fix on the top of the patch #950
1 parent 92454a4 commit b284d3c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nginx/modsecurity/ngx_http_modsecurity.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,12 @@ ngx_http_modsecurity_load_request(ngx_http_request_t *r)
364364
/* &r->headers_in.user); */
365365
req->parsed_uri.fragment = (char *)ngx_pstrdup0(r->pool, &r->exten);
366366

367-
req->hostname = (char *)ngx_pstrdup0(r->pool,
367+
if (&r->headers_in != NULL && &r->headers_in.server != NULL) {
368+
req->hostname = (char *)ngx_pstrdup0(r->pool, &r->headers_in.server);
369+
} else {
370+
req->hostname = (char *)ngx_pstrdup0(r->pool,
368371
(ngx_str_t *)&ngx_cycle->hostname);
369-
372+
}
370373

371374
if (r->header_only) {
372375
req->header_only = r->header_only;

0 commit comments

Comments
 (0)