From 164abfb26f0f98155d11d8b41567f5b42575bb04 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Fri, 24 Oct 2008 19:34:24 +0000 Subject: fix case proxy_pass URL is evaluted to http://host?args --- src/core/ngx_inet.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index e976c4cdb..35638e53b 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -251,7 +251,7 @@ ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u) static ngx_int_t ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u) { - u_char *p, *host, *port, *last, *uri; + u_char *p, *host, *port, *last, *uri, *args; size_t len; ngx_int_t n; struct hostent *h; @@ -266,6 +266,17 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u) uri = ngx_strlchr(host, last, '/'); + args = ngx_strlchr(host, last, '?'); + + if (args) { + if (uri == NULL) { + uri = args; + + } else if (args < uri) { + uri = args; + } + } + if (uri) { if (u->listen || !u->uri_part) { u->err = "invalid host"; -- cgit