Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bugfix: ngx.exit(status) always resulted in 200 OK response status wh…

…en status > 200 and status < 300. thanks Nginx User for reporting this issue.
  • Loading branch information...
commit d577a3818bf4b97dcdefc536349f783401ffdc79 1 parent 63daa75
@agentzh agentzh authored
Showing with 30 additions and 1 deletion.
  1. +6 −0 src/ngx_http_lua_util.c
  2. +24 −1 t/023-rewrite/exit.t
View
6 src/ngx_http_lua_util.c
@@ -1835,6 +1835,12 @@ ngx_http_lua_handle_exit(lua_State *L, ngx_http_request_t *r,
"lua thread aborting request with status %d",
ctx->exit_code);
+#if 1
+ if (!ctx->headers_sent && ctx->exit_code >= NGX_HTTP_OK) {
+ r->headers_out.status = ctx->exit_code;
+ }
+#endif
+
ngx_http_lua_del_thread(r, L, cc_ref);
ctx->cc_ref = LUA_NOREF;
View
25 t/023-rewrite/exit.t
@@ -13,7 +13,7 @@ repeat_each(2);
#log_level('warn');
#worker_connections(1024);
-plan tests => repeat_each() * (blocks() * 2);
+plan tests => repeat_each() * (blocks() * 2 + 1);
$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;
$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
@@ -540,3 +540,26 @@ morning
This is our own content
--- error_code: 410
+
+
+=== TEST 17: encode args table with a multi-value arg.
+--- config
+ location = /t {
+ rewrite_by_lua '
+ ngx.exit(204)
+ ';
+
+ proxy_pass http://127.0.0.1:$server_port/blah;
+ }
+
+ location = /blah {
+ echo blah;
+ }
+--- request
+GET /t
+--- more_headers2
+--- response_body
+--- error_code: 204
+--- no_error_log
+[error]
+
Please sign in to comment.
Something went wrong with that request. Please try again.