diff src/http/ngx_http_variables.c @ 928:a6fe6bedb9e3

fix segfault when $host is used and *) request is "GET http://host" without CR or LF, or timed out *) request is "GET http://host" with a large blank space
author Igor Sysoev <igor@sysoev.ru>
date Fri, 15 Dec 2006 10:24:57 +0000
parents 7521e5f5d555
children 664afe2c1480
line wrap: on
line diff
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -678,9 +678,13 @@ ngx_http_variable_host(ngx_http_request_
             v->data = r->server_name.data;
         }
 
-    } else {
+    } else if (r->host_end) {
         v->len = r->host_end - r->host_start;
         v->data = r->host_start;
+
+    } else {
+        v->not_found = 1;
+        return NGX_OK;
     }
 
     v->valid = 1;