summaryrefslogtreecommitdiff
path: root/modules/http
diff options
context:
space:
mode:
authorJim Jagielski <jim@apache.org>2016-12-12 15:21:29 +0000
committerJim Jagielski <jim@apache.org>2016-12-12 15:21:29 +0000
commit541623e63b7ff10a6fa1cf45e6331fc99b57ef6c (patch)
tree029081a019524fca1754617e251302f9bff15db4 /modules/http
parentbb85ed16453629b03e478d33dbe2a2439232c9bf (diff)
downloadhttpd-541623e63b7ff10a6fa1cf45e6331fc99b57ef6c.tar.gz
Merge r1773346 from trunk:
Drop C-L header and message-body from HTTP 204 responses. The C-L header can be set in a fcgi/cgi backend or in other filters like ap_content_length_filter (with the value of 0), meanwhile the message-body can be returned incorrectly by any backend. The idea is to remove unnecessary bytes from a HTTP 204 response. PR 51350 Submitted by: elukey Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1773801 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/http')
-rw-r--r--modules/http/http_filters.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c
index 45c1d81198..9ce2a2a599 100644
--- a/modules/http/http_filters.c
+++ b/modules/http/http_filters.c
@@ -1262,7 +1262,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
AP_DEBUG_ASSERT(!r->main);
- if (r->header_only) {
+ if (r->header_only || r->status == HTTP_NO_CONTENT) {
if (!ctx) {
ctx = f->ctx = apr_pcalloc(r->pool, sizeof(header_filter_ctx));
}
@@ -1353,6 +1353,10 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
apr_table_unset(r->headers_out, "Content-Length");
}
+ if (r->status == HTTP_NO_CONTENT) {
+ apr_table_unset(r->headers_out, "Content-Length");
+ }
+
ctype = ap_make_content_type(r, r->content_type);
if (ctype) {
apr_table_setn(r->headers_out, "Content-Type", ctype);
@@ -1442,7 +1446,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
ap_pass_brigade(f->next, b2);
- if (r->header_only) {
+ if (r->header_only || r->status == HTTP_NO_CONTENT) {
apr_brigade_cleanup(b);
ctx->headers_sent = 1;
return OK;