Skip to content

Commit ccc748e

Browse files
baluschzhuizhuhaomeng
authored andcommitted
bugfix: fix nginx crash caused by a bad format specifier.
1 parent a6e9e11 commit ccc748e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/ngx_http_lua_subrequest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ ngx_http_lua_adjust_subrequest(ngx_http_request_t *sr, ngx_uint_t method,
734734

735735
default:
736736
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
737-
"unsupported HTTP method: %u", (unsigned) method);
737+
"unsupported HTTP method: %ui", method);
738738

739739
return NGX_ERROR;
740740
}

t/020-subrequest.t

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3391,3 +3391,22 @@ method: POST, uri: /foo
33913391
0
33923392
--- no_error_log
33933393
[error]
3394+
3395+
3396+
3397+
=== TEST 81: bad HTTP method
3398+
--- config
3399+
location /other { }
3400+
3401+
location /lua {
3402+
content_by_lua_block {
3403+
local res = ngx.location.capture("/other",
3404+
{ method = 10240 });
3405+
}
3406+
}
3407+
--- request
3408+
GET /lua
3409+
--- response_body_like: 500 Internal Server Error
3410+
--- error_code: 500
3411+
--- error_log
3412+
unsupported HTTP method: 10240

0 commit comments

Comments
 (0)