changeset 3977:2527cdb8d31f

test length of proxy_pass with variables patch by Lanshun Zhou
author Igor Sysoev <igor@sysoev.ru>
date Sat, 30 Jul 2011 06:11:46 +0000
parents 215fe9223419
children 6b608bf9f3ae
files src/http/modules/ngx_http_proxy_module.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
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;