# HG changeset patch # User Igor Sysoev # Date 1312006306 0 # Node ID 2527cdb8d31f1626bb5e2a0930b6384d6ce03529 # Parent 215fe92234192c9940958d2884d77d687639b98d test length of proxy_pass with variables patch by Lanshun Zhou diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c --- 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;