diff src/core/ngx_inet.c @ 2284:c3035feb6638

fix case proxy_pass URL is evaluted to http://host?args
author Igor Sysoev <igor@sysoev.ru>
date Fri, 24 Oct 2008 19:34:24 +0000
parents 231b52f8adc0
children 148c2e840c2b
line wrap: on
line diff
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -251,7 +251,7 @@ ngx_parse_unix_domain_url(ngx_pool_t *po
 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
 
     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";