[nginx] Setting $args now invalidates unparsed uri.

Maxim Dounin mdounin at mdounin.ru
Mon May 19 18:47:18 UTC 2014


details:   http://hg.nginx.org/nginx/rev/e9dbffc18a77
branches:  
changeset: 5699:e9dbffc18a77
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Mon May 19 22:45:35 2014 +0400
description:
Setting $args now invalidates unparsed uri.

Prodded by Yichun Zhang.

diffstat:

 src/http/ngx_http_variables.c |  20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diffs (67 lines):

diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -13,8 +13,10 @@
 
 static ngx_int_t ngx_http_variable_request(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data);
+#if 0
 static void ngx_http_variable_request_set(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data);
+#endif
 static ngx_int_t ngx_http_variable_request_get_size(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data);
 static void ngx_http_variable_request_set_size(ngx_http_request_t *r,
@@ -64,6 +66,8 @@ static ngx_int_t ngx_http_variable_schem
     ngx_http_variable_value_t *v, uintptr_t data);
 static ngx_int_t ngx_http_variable_https(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data);
+static void ngx_http_variable_set_args(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data);
 static ngx_int_t ngx_http_variable_is_args(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data);
 static ngx_int_t ngx_http_variable_document_root(ngx_http_request_t *r,
@@ -223,7 +227,7 @@ static ngx_http_variable_t  ngx_http_cor
       NGX_HTTP_VAR_NOCACHEABLE, 0 },
 
     { ngx_string("args"),
-      ngx_http_variable_request_set,
+      ngx_http_variable_set_args,
       ngx_http_variable_request,
       offsetof(ngx_http_request_t, args),
       NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE, 0 },
@@ -662,6 +666,8 @@ ngx_http_variable_request(ngx_http_reque
 }
 
 
+#if 0
+
 static void
 ngx_http_variable_request_set(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data)
@@ -674,6 +680,8 @@ ngx_http_variable_request_set(ngx_http_r
     s->data = v->data;
 }
 
+#endif
+
 
 static ngx_int_t
 ngx_http_variable_request_get_size(ngx_http_request_t *r,
@@ -1371,6 +1379,16 @@ ngx_http_variable_https(ngx_http_request
 }
 
 
+static void
+ngx_http_variable_set_args(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data)
+{
+    r->args.len = v->len;
+    r->args.data = v->data;
+    r->valid_unparsed_uri = 0;
+}
+
+
 static ngx_int_t
 ngx_http_variable_is_args(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data)



More information about the nginx-devel mailing list