Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Бага в proxy_method
Hello!
On Mon, Jan 14, 2013 at 03:28:32PM +0400, Михаил Монашёв wrote:
> Здравствуйте, Maxim.
>
> > А, нет, вру, должно быть всё нормально и без пробела, это
> > действительно бага.
>
> > У тебя proxy_method задан на уровне http{}, да?
>
> Да, на уровне http{}.
Патч.
# HG changeset patch
# User Maxim Dounin <mdounin@xxxxxxxxxx>
# Date 1358167486 -14400
# Node ID d94906442d522529b6daf9c955cdb9a264755979
# Parent 13c4c155f26f772b0bc1074a05298088d6499218
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.
diff --git a/src/http/modules/ngx_http_proxy_module.c
b/src/http/modules/ngx_http_proxy_module.c
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -2353,7 +2353,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;
@@ -2652,10 +2652,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++;
}
--
Maxim Dounin
http://nginx.com/support.html
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru
|