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
index 147422a..495b174 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -642,15 +642,17 @@
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;