diff src/http/modules/ngx_http_proxy_module.c @ 4045:2d062c031fff stable-1.0

Merge of r3964, r3977, r3978: Proxy related fixes: *) finalizing with rc == 0 in unbuffered proxy mode caused nginx to wait for another send_timeout before actually closing client's connection if client timed out while still talking to upstream server *) update r3945 with more descriptive error message *) test length of proxy_pass with variables; patch by Lanshun Zhou
author Igor Sysoev <igor@sysoev.ru>
date Mon, 29 Aug 2011 12:56:09 +0000
parents f4c49c9e4bb5
children 88369902edb1
line wrap: on
line diff
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -642,15 +642,17 @@ ngx_http_proxy_eval(ngx_http_request_t *
         return NGX_ERROR;
     }
 
-    if (ngx_strncasecmp(proxy.data, (u_char *) "http://", 7) == 0) {
-
+    if (proxy.len > 7
+        && ngx_strncasecmp(proxy.data, (u_char *) "http://", 7) == 0)
+    {
         add = 7;
         port = 80;
 
 #if (NGX_HTTP_SSL)
 
-    } else if (ngx_strncasecmp(proxy.data, (u_char *) "https://", 8) == 0) {
-
+    } else if (proxy.len > 8
+               && ngx_strncasecmp(proxy.data, (u_char *) "https://", 8) == 0)
+    {
         add = 8;
         port = 443;
         r->upstream->ssl = 1;
@@ -1707,6 +1709,8 @@ ngx_http_proxy_create_loc_conf(ngx_conf_
     conf->headers_hash_max_size = NGX_CONF_UNSET_UINT;
     conf->headers_hash_bucket_size = NGX_CONF_UNSET_UINT;
 
+    ngx_str_set(&conf->upstream.module, "proxy");
+
     return conf;
 }