comparison 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
comparison
equal deleted inserted replaced
2283:231b52f8adc0 2284:c3035feb6638
249 249
250 250
251 static ngx_int_t 251 static ngx_int_t
252 ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u) 252 ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u)
253 { 253 {
254 u_char *p, *host, *port, *last, *uri; 254 u_char *p, *host, *port, *last, *uri, *args;
255 size_t len; 255 size_t len;
256 ngx_int_t n; 256 ngx_int_t n;
257 struct hostent *h; 257 struct hostent *h;
258 258
259 u->family = AF_INET; 259 u->family = AF_INET;
263 last = host + u->url.len; 263 last = host + u->url.len;
264 264
265 port = ngx_strlchr(host, last, ':'); 265 port = ngx_strlchr(host, last, ':');
266 266
267 uri = ngx_strlchr(host, last, '/'); 267 uri = ngx_strlchr(host, last, '/');
268
269 args = ngx_strlchr(host, last, '?');
270
271 if (args) {
272 if (uri == NULL) {
273 uri = args;
274
275 } else if (args < uri) {
276 uri = args;
277 }
278 }
268 279
269 if (uri) { 280 if (uri) {
270 if (u->listen || !u->uri_part) { 281 if (u->listen || !u->uri_part) {
271 u->err = "invalid host"; 282 u->err = "invalid host";
272 return NGX_ERROR; 283 return NGX_ERROR;