[PATCH] Index: fixed handling of non-cacheable variables

Maxim Dounin mdounin at mdounin.ru
Sun Jul 12 22:12:56 UTC 2026


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1783887423 -10800
#      Sun Jul 12 23:17:03 2026 +0300
# Node ID 70007ea1f8a1878f81189538863dbeb2d80bd2fd
# Parent  ca8fb89254b3baaa40a421599d4a541c7c02155f
Index: fixed handling of non-cacheable variables.

Previously, "e.flushed = 1;" was incorrectly used during initial length
calculations, and as a result non-cacheable variables were not flushed.
The fix is to only set "e.flushed" when evaluating values.

A similar issue in try_files was fixed in 2424:46d11bff21ef (0.7.29).

diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c
--- a/src/http/modules/ngx_http_index_module.c
+++ b/src/http/modules/ngx_http_index_module.c
@@ -149,7 +149,6 @@ ngx_http_index_handler(ngx_http_request_
 
             e.ip = index[i].lengths->elts;
             e.request = r;
-            e.flushed = 1;
 
             /* 1 is for terminating '\0' as in static names */
             len = 1;
@@ -186,6 +185,7 @@ ngx_http_index_handler(ngx_http_request_
             e.ip = index[i].values->elts;
             e.pos = name;
             e.end = name + allocated;
+            e.flushed = 1;
 
             while (*(uintptr_t *) e.ip) {
                 code = *(ngx_http_script_code_pt *) e.ip;



More information about the nginx-devel mailing list