Mercurial > hg > nginx-mail
diff src/http/modules/ngx_http_proxy_module.c @ 445: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 | b246022ef454 |
children | dac47e9ef0d5 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -536,10 +536,11 @@ static ngx_int_t ngx_http_proxy_eval(ngx_http_request_t *r, ngx_http_proxy_ctx_t *ctx, ngx_http_proxy_loc_conf_t *plcf) { - size_t add; - u_short port; - ngx_str_t proxy; - ngx_url_t u; + u_char *p; + size_t add; + u_short port; + ngx_str_t proxy; + ngx_url_t u; if (ngx_http_script_run(r, &proxy, plcf->proxy_lengths->elts, 0, plcf->proxy_values->elts) @@ -589,6 +590,19 @@ ngx_http_proxy_eval(ngx_http_request_t * return NGX_ERROR; } + if (u.uri.len && u.uri.data[0] == '?') { + p = ngx_pnalloc(r->pool, u.uri.len + 1); + if (p == NULL) { + return NGX_ERROR; + } + + *p++ = '/'; + ngx_memcpy(p, u.uri.data, u.uri.len); + + u.uri.len++; + u.uri.data = p - 1; + } + if (ngx_http_proxy_set_vars(r->pool, &u, &ctx->vars) != NGX_OK) { return NGX_ERROR; } @@ -602,7 +616,7 @@ ngx_http_proxy_eval(ngx_http_request_t * r->upstream->resolved->host = u.host; r->upstream->resolved->port = (in_port_t) (u.no_port ? u.default_port: u.port); - r->upstream->resolved->default_port = u.default_port; + r->upstream->resolved->no_port = u.no_port; return NGX_OK; }