Mercurial > hg > nginx-vendor-current
diff src/http/modules/ngx_http_proxy_module.c @ 658:5a4401b9551b NGINX_1_1_13
nginx 1.1.13
*) Feature: the "TLSv1.1" and "TLSv1.2" parameters of the
"ssl_protocols" directive.
*) Bugfix: the "limit_req" directive parameters were not inherited
correctly; the bug had appeared in 1.1.12.
*) Bugfix: the "proxy_redirect" directive incorrectly processed
"Refresh" header if regular expression were used.
*) Bugfix: the "proxy_cache_use_stale" directive with "error" parameter
did not return answer from cache if there were no live upstreams.
*) Bugfix: the "worker_cpu_affinity" directive might not work.
*) Bugfix: nginx could not be built on Solaris; the bug had appeared in
1.1.12.
*) Bugfix: in the ngx_http_mp4_module.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 16 Jan 2012 00:00:00 +0400 |
parents | 9d21dad0b5a1 |
children | d0f7a625f27c |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -2348,6 +2348,8 @@ static ngx_int_t ngx_http_proxy_rewrite_redirect_regex(ngx_http_request_t *r, ngx_table_elt_t *h, size_t prefix, ngx_http_proxy_redirect_t *pr) { + size_t len; + u_char *data; ngx_str_t redirect, replacement; redirect.len = h->value.len - prefix; @@ -2361,7 +2363,23 @@ ngx_http_proxy_rewrite_redirect_regex(ng return NGX_ERROR; } - h->value = replacement; + if (!prefix) { + h->value = replacement; + return NGX_OK; + } + + len = prefix + replacement.len; + + data = ngx_pnalloc(r->pool, len); + if (data == NULL) { + return NGX_ERROR; + } + + ngx_memcpy(data, h->value.data, prefix); + ngx_memcpy(data + prefix, replacement.data, replacement.len); + + h->value.len = len; + h->value.data = data; return NGX_OK; } @@ -2667,17 +2685,21 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t (NGX_CONF_BITMASK_SET |NGX_HTTP_UPSTREAM_FT_OFF)); + if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) { + conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET + |NGX_HTTP_UPSTREAM_FT_OFF; + } + + if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_ERROR) { + conf->upstream.cache_use_stale |= NGX_HTTP_UPSTREAM_FT_NOLIVE; + } + if (conf->upstream.cache_methods == 0) { conf->upstream.cache_methods = prev->upstream.cache_methods; } conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD; - if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) { - conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET - |NGX_HTTP_UPSTREAM_FT_OFF; - } - ngx_conf_merge_ptr_value(conf->upstream.cache_bypass, prev->upstream.cache_bypass, NULL); @@ -3580,7 +3602,9 @@ ngx_http_proxy_set_ssl(ngx_conf_t *cf, n plcf->upstream.ssl->log = cf->log; if (ngx_ssl_create(plcf->upstream.ssl, - NGX_SSL_SSLv2|NGX_SSL_SSLv3|NGX_SSL_TLSv1, NULL) + NGX_SSL_SSLv2|NGX_SSL_SSLv3|NGX_SSL_TLSv1 + |NGX_SSL_TLSv1_1|NGX_SSL_TLSv1_2, + NULL) != NGX_OK) { return NGX_ERROR;