Welcome! Log In Create A New Profile

Advanced

[nginx] Proxy: support variables for proxy_method directive.

Maxim Dounin
October 26, 2016 01:34PM
details: http://hg.nginx.org/nginx/rev/ca27074f8f0f
branches:
changeset: 6781:ca27074f8f0f
user: Dmitry Lazurkin <dilaz03@gmail.com>
date: Sun Oct 16 18:24:01 2016 +0300
description:
Proxy: support variables for proxy_method directive.

diffstat:

src/http/modules/ngx_http_proxy_module.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)

diffs (54 lines):

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
@@ -73,7 +73,7 @@ typedef struct {
ngx_array_t *cookie_domains;
ngx_array_t *cookie_paths;

- ngx_str_t method;
+ ngx_http_complex_value_t *method;
ngx_str_t location;
ngx_str_t url;

@@ -380,7 +380,7 @@ static ngx_command_t ngx_http_proxy_com

{ ngx_string("proxy_method"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_str_slot,
+ ngx_http_set_complex_value_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_proxy_loc_conf_t, method),
NULL },
@@ -1159,8 +1159,10 @@ ngx_http_proxy_create_request(ngx_http_r
/* HEAD was changed to GET to cache response */
method = u->method;

- } else if (plcf->method.len) {
- method = plcf->method;
+ } else if (plcf->method) {
+ if (ngx_http_complex_value(r, plcf->method, &method) != NGX_OK) {
+ return NGX_ERROR;
+ }

} else {
method = r->method_name;
@@ -2797,7 +2799,7 @@ ngx_http_proxy_create_loc_conf(ngx_conf_
* conf->upstream.store_values = NULL;
* conf->upstream.ssl_name = NULL;
*
- * conf->method = { 0, NULL };
+ * conf->method = NULL;
* conf->headers_source = NULL;
* conf->headers.lengths = NULL;
* conf->headers.values = NULL;
@@ -3158,7 +3160,9 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t

#endif

- ngx_conf_merge_str_value(conf->method, prev->method, "");
+ if (conf->method == NULL) {
+ conf->method = prev->method;
+ }

ngx_conf_merge_value(conf->upstream.pass_request_headers,
prev->upstream.pass_request_headers, 1);

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Proxy: support variables for proxy_method directive.

Maxim Dounin 575 October 26, 2016 01:34PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 283
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready