comparison src/core/ngx_inet.c @ 416:b4f69f2ef02c NGINX_0_7_20

nginx 0.7.20 *) Changes in the ngx_http_gzip_filter_module. *) Feature: the ngx_http_limit_req_module. *) Bugfix: worker processes might exit on a SIGBUS signal on sparc and ppc platforms; the bug had appeared in 0.7.3. Thanks to Maxim Dounin. *) Bugfix: the "proxy_pass http://host/some:uri" directives did not work; the bug had appeared in 0.7.12. *) Bugfix: in HTTPS mode requests might fail with the "bad write retry" error. *) Bugfix: the ngx_http_secure_link_module did not work inside locations, whose names are less than 3 characters. *) Bugfix: $server_addr variable might have no value.
author Igor Sysoev <http://sysoev.ru>
date Mon, 10 Nov 2008 00:00:00 +0300
parents 6ebbca3d5ed7
children ff86d646f9df
comparison
equal deleted inserted replaced
415:5410f1e19796 416:b4f69f2ef02c
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;
262 262
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(port ? port : 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;
274 285
275 u->uri.len = last - uri; 286 u->uri.len = last - uri;
276 u->uri.data = uri; 287 u->uri.data = uri;
277 288
278 last = uri; 289 last = uri;
290
291 if (uri < port) {
292 port = NULL;
293 }
279 } 294 }
280 295
281 if (port) { 296 if (port) {
282 port++; 297 port++;
283 298