Skip to content

feature: add function to bypass HTTP conditional request checks #2401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/ngx_http_lua_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: */
30 changes: 30 additions & 0 deletions t/014-bugs.t
Original file line number Diff line number Diff line change
Expand Up @@ -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/