[patch] Http image_filter: return 405 when method is HEAD and body is empty.
胡聪 (hucc)
hucong.c at foxmail.com
Mon Jun 19 16:56:15 UTC 2017
Hi,
Returning 415 does not conform to the HTTP protocol when image and proxy_pass
configured in same location.
# HG changeset patch
# User hucongcong <hucong.c at foxmail.com>
# Date 1497890354 -28800
# Tue Jun 20 00:39:14 2017 +0800
# Node ID af3a94de6a6549dec5e1205514eda1893313a14c
# Parent d1816a2696de8c2faa1cd913a151e5f62a8620f3
Http image_filter: return 405 when method is HEAD and body is empty.
diff -r d1816a2696de -r af3a94de6a65 src/http/modules/ngx_http_image_filter_module.c
--- a/src/http/modules/ngx_http_image_filter_module.c Fri Jun 16 18:15:58 2017 +0300
+++ b/src/http/modules/ngx_http_image_filter_module.c Tue Jun 20 00:39:14 2017 +0800
@@ -330,6 +330,12 @@ ngx_http_image_body_filter(ngx_http_requ
}
}
+ if (r->method & NGX_HTTP_HEAD) {
+ return ngx_http_filter_finalize_request(r,
+ &ngx_http_image_filter_module,
+ NGX_HTTP_NOT_ALLOWED);
+ }
+
return ngx_http_filter_finalize_request(r,
&ngx_http_image_filter_module,
NGX_HTTP_UNSUPPORTED_MEDIA_TYPE);
More information about the nginx-devel
mailing list