diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2021-01-19 20:21:12 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2021-01-19 20:21:12 +0300 |
commit | d2c0b9a6c7b0757d5d55db36b1ae656bba056a8c (patch) | |
tree | 7d2d200a13b85abfc6e9aa6c324d2fd28c706e72 /src/http/ngx_http_core_module.c | |
parent | e1ca9851220bb6d5f8e6b967635078f35a423c7c (diff) | |
download | nginx-d2c0b9a6c7b0757d5d55db36b1ae656bba056a8c.tar.gz nginx-d2c0b9a6c7b0757d5d55db36b1ae656bba056a8c.zip |
Removed incorrect optimization of HEAD requests.
The stub status module and ngx_http_send_response() (used by the empty gif
module and the "return" directive) incorrectly assumed that responding
to HEAD requests always results in r->header_only being set. This is not
true, and results in incorrect behaviour, for example, in the following
configuration:
location / {
image_filter size;
return 200 test;
}
Fix is to remove this incorrect micro-optimization from both stub status
module and ngx_http_send_response().
Reported by Chris Newton.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r-- | src/http/ngx_http_core_module.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 3671558d8..aa40c9985 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1782,7 +1782,7 @@ ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status, } } - if (r->method == NGX_HTTP_HEAD || (r != r->main && val.len == 0)) { + if (r != r->main && val.len == 0) { return ngx_http_send_header(r); } |