Skip to content

Commit 4cc436a

Browse files
Felipe Zimmerlechewi
Felipe Zimmerle
authored andcommitted
Small fix on the top of the patch owasp-modsecurity#950
1 parent d23faa1 commit 4cc436a

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
@@ -363,9 +363,12 @@ ngx_http_modsecurity_load_request(ngx_http_request_t *r)
363363
/* &r->headers_in.user); */
364364
req->parsed_uri.fragment = (char *)ngx_pstrdup0(r->pool, &r->exten);
365365

366-
req->hostname = (char *)ngx_pstrdup0(r->pool,
366+
if (&r->headers_in != NULL && &r->headers_in.server != NULL) {
367+
req->hostname = (char *)ngx_pstrdup0(r->pool, &r->headers_in.server);
368+
} else {
369+
req->hostname = (char *)ngx_pstrdup0(r->pool,
367370
(ngx_str_t *)&ngx_cycle->hostname);
368-
371+
}
369372

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

0 commit comments

Comments
 (0)