From 411dc15a4a876969104268e1de1d5200872c52e9 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Thu, 10 Dec 2015 14:39:02 -0300 Subject: [PATCH] Small fix on the top of the patch #950 --- nginx/modsecurity/ngx_http_modsecurity.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nginx/modsecurity/ngx_http_modsecurity.c b/nginx/modsecurity/ngx_http_modsecurity.c index ef4b55f0..2f99ab4b 100644 --- a/nginx/modsecurity/ngx_http_modsecurity.c +++ b/nginx/modsecurity/ngx_http_modsecurity.c @@ -363,9 +363,12 @@ ngx_http_modsecurity_load_request(ngx_http_request_t *r) /* &r->headers_in.user); */ req->parsed_uri.fragment = (char *)ngx_pstrdup0(r->pool, &r->exten); - req->hostname = (char *)ngx_pstrdup0(r->pool, + if (&r->headers_in != NULL && &r->headers_in.server != NULL) { + req->hostname = (char *)ngx_pstrdup0(r->pool, &r->headers_in.server); + } else { + req->hostname = (char *)ngx_pstrdup0(r->pool, (ngx_str_t *)&ngx_cycle->hostname); - + } if (r->header_only) { req->header_only = r->header_only;