]> git.kaiwu.me - nginx.git/commitdiff
Variables: honor no_cacheable for not_found variables.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 13 Feb 2012 15:31:07 +0000 (15:31 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 13 Feb 2012 15:31:07 +0000 (15:31 +0000)
Variables with the "not_found" flag set follow the same rules as ones with
the "valid" flag set.  Make sure ngx_http_get_flushed_variable() will flush
non-cacheable variables with the "not_found" flag set.

This fixes at least one known problem with $args not available in a subrequest
(with args) when there were no args in the main request and $args variable was
queried in the main request (reported by Laurence Rowe aka elro on irc).

Also this eliminates unneeded call to ngx_http_get_indexed_variable() in
cacheable case (as it will return cached value anyway).

src/http/ngx_http_variables.c

index d6bb92c9863ab69f9defb2a971b1e2d6f2a36279..78cfa234a218123a7d9c1cd45b7f4e41317011a5 100644 (file)
@@ -432,7 +432,7 @@ ngx_http_get_flushed_variable(ngx_http_request_t *r, ngx_uint_t index)
 
     v = &r->variables[index];
 
-    if (v->valid) {
+    if (v->valid || v->not_found) {
         if (!v->no_cacheable) {
             return v;
         }