File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,11 @@ ngx_http_lua_header_filter_by_chunk(lua_State *L, ngx_http_request_t *r)
131131 dd ("exited: %d, exit code: %d, old exit code: %d" ,
132132 (int ) ctx -> exited , (int ) ctx -> exit_code , (int ) old_exit_code );
133133
134+ #if 1
135+ /* clear Lua stack */
136+ lua_settop (L , 0 );
137+ #endif
138+
134139 if (ctx -> exited && ctx -> exit_code != old_exit_code ) {
135140 if (ctx -> exit_code == NGX_ERROR ) {
136141 return NGX_ERROR ;
@@ -147,9 +152,6 @@ ngx_http_lua_header_filter_by_chunk(lua_State *L, ngx_http_request_t *r)
147152 return NGX_DECLINED ;
148153 }
149154
150- /* clear Lua stack */
151- lua_settop (L , 0 );
152-
153155 return NGX_OK ;
154156}
155157
Original file line number Diff line number Diff line change @@ -767,3 +767,28 @@ GET /lua?a=1&b=2
767767-- - error_log eval
768768qr/ failed to load external Lua file " .*?test2\.lua" : cannot open .*? No such file or directory/
769769
770+
771+
772+ === TEST 41 : filter finalize
773+ -- - config
774+ error_page 582 = /bar;
775+ location = /t {
776+ echo ok ;
777+ header_filter_by_lua '
778+ return ngx.exit(582)
779+ ' ;
780+ }
781+
782+ location = /bar {
783+ echo hi;
784+ header_filter_by_lua '
785+ return ngx.exit(302)
786+ ' ;
787+ }
788+ --- request
789+ GET /t
790+ -- - response_body_like: 302 Found
791+ -- - error_code: 302
792+ -- - no_error_log
793+ [error]
794+
You can’t perform that action at this time.
0 commit comments