changeset 5060:8fff74441755 stable-1.2

Merge of r5013: proxy: fixed proxy_method to always add space. Before the patch if proxy_method was specified at http{} level the code to add trailing space wasn't executed, resulting in incorrect requests to upstream.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 11 Feb 2013 15:31:10 +0000
parents 0419c3321bf2
children 7ce4ecb6df5c
files src/http/modules/ngx_http_proxy_module.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -2608,7 +2608,7 @@ ngx_http_proxy_create_loc_conf(ngx_conf_
      *     conf->upstream.store_lengths = NULL;
      *     conf->upstream.store_values = NULL;
      *
-     *     conf->method = NULL;
+     *     conf->method = { 0, NULL };
      *     conf->headers_source = NULL;
      *     conf->headers_set_len = NULL;
      *     conf->headers_set = NULL;
@@ -2907,10 +2907,11 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
 
 #endif
 
-    if (conf->method.len == 0) {
-        conf->method = prev->method;
-
-    } else {
+    ngx_conf_merge_str_value(conf->method, prev->method, "");
+
+    if (conf->method.len
+        && conf->method.data[conf->method.len - 1] != ' ')
+    {
         conf->method.data[conf->method.len] = ' ';
         conf->method.len++;
     }