diff --git a/src/ngx_http_lua_util.c b/src/ngx_http_lua_util.c index c73bddc609..61f56cb7c0 100644 --- a/src/ngx_http_lua_util.c +++ b/src/ngx_http_lua_util.c @@ -4555,4 +4555,10 @@ ngx_http_lua_parse_addr(lua_State *L, u_char *text, size_t len) } +void +ngx_http_lua_ffi_bypass_if_checks(ngx_http_request_t *r) +{ + r->disable_not_modified = 1; +} + /* vi:set ft=c ts=4 sw=4 et fdm=marker: */ diff --git a/t/014-bugs.t b/t/014-bugs.t index 303187929f..9d57afe134 100644 --- a/t/014-bugs.t +++ b/t/014-bugs.t @@ -1366,3 +1366,33 @@ If-Match: 1 --- error_code: 412 --- response_body eval qr/\Ahello\z/ + + + +=== TEST 50: nginx crashes when encountering an illegal http if header +crash with ngx.print() +--- main_config +--- config +error_page 412 /my_error_handler_412; + +location /t { + access_by_lua_block { + local ngx_resp = require "ngx.resp" + ngx_resp.bypass_if_checks() + ngx.print("hello") + ngx.exit(200) + } +} +location = /my_error_handler_412 { + content_by_lua_block { + ngx.sleep(0.002) + ngx.header["Content-Type"] = "text/plain" + } +} +--- request + GET /t +--- more_headers +If-Match: 1 +--- error_code: 200 +--- response_body eval +qr/\Ahello\z/