aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_proxy_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-05-29 17:28:12 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-05-29 17:28:12 +0000
commitafd7ec53572d817d155be5b8a5b6aab7ebbdcb5a (patch)
tree5543319d12f175a80fbdc6b10e72788d91a0a623 /src/http/modules/ngx_http_proxy_module.c
parenta33fd634b0606f068ad39edd8374c035d353c590 (diff)
downloadnginx-release-0.3.48.tar.gz
nginx-release-0.3.48.zip
nginx-0.3.48-RELEASE importrelease-0.3.48
*) Change: now the ngx_http_charset_module works for subrequests, if the response has no "Content-Type" header line. *) Bugfix: if the "proxy_pass" directive has no URI part, then the "proxy_redirect default" directive add the unnecessary slash in start of the rewritten redirect. *) Bugfix: the internal redirect always transform client's HTTP method to GET, now the transformation is made for the "X-Accel-Redirect" redirects only and if the method is not HEAD; the bug had appeared in 0.3.42. *) Bugfix: the ngx_http_perl_module could not be built, if the perl was built with the threads support; the bug had appeared in 0.3.46.
Diffstat (limited to 'src/http/modules/ngx_http_proxy_module.c')
-rw-r--r--src/http/modules/ngx_http_proxy_module.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index f5fb9184b..31a4355e5 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -1349,7 +1349,9 @@ ngx_http_proxy_rewrite_redirect_text(ngx_http_request_t *r, ngx_table_elt_t *h,
p = ngx_copy(p, h->value.data, prefix);
- p = ngx_copy(p, pr->replacement.text.data, pr->replacement.text.len);
+ if (pr->replacement.text.len) {
+ p = ngx_copy(p, pr->replacement.text.data, pr->replacement.text.len);
+ }
ngx_memcpy(p, h->value.data + prefix + pr->redirect.len,
h->value.len - pr->redirect.len - prefix);
@@ -1694,7 +1696,14 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
pr->handler = ngx_http_proxy_rewrite_redirect_text;
pr->redirect = conf->upstream.url;
- pr->replacement.text = conf->upstream.location;
+
+ if (conf->upstream.uri.len) {
+ pr->replacement.text = conf->upstream.location;
+
+ } else {
+ pr->replacement.text.len = 0;
+ pr->replacement.text.data = NULL;
+ }
}
}
@@ -2263,7 +2272,14 @@ ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
pr->handler = ngx_http_proxy_rewrite_redirect_text;
pr->redirect = plcf->upstream.url;
- pr->replacement.text = plcf->upstream.location;
+
+ if (plcf->upstream.uri.len) {
+ pr->replacement.text = plcf->upstream.location;
+
+ } else {
+ pr->replacement.text.len = 0;
+ pr->replacement.text.data = NULL;
+ }
return NGX_CONF_OK;
}