Index: modules/http/http_filters.c =================================================================== --- modules/http/http_filters.c (revision 1853992) +++ modules/http/http_filters.c (working copy) @@ -1289,6 +1289,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_heade { request_rec *r = f->r; conn_rec *c = r->connection; + int header_only = (r->header_only || AP_STATUS_IS_HEADER_ONLY(r->status)); const char *clheader; const char *protocol = NULL; apr_bucket *e; @@ -1307,7 +1308,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_heade } else if (ctx->headers_sent) { /* Eat body if response must not have one. */ - if (r->header_only || AP_STATUS_IS_HEADER_ONLY(r->status)) { + if (header_only) { /* Still next filters may be waiting for EOS, so pass it (alone) * when encountered and be done with this filter. */ @@ -1522,14 +1523,21 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_heade terminate_header(b2); + if (header_only) { + e = APR_BRIGADE_LAST(b); + if (APR_BUCKET_IS_EOS(e)) { + APR_BUCKET_REMOVE(e); + APR_BRIGADE_INSERT_TAIL(b2, e); + ap_remove_output_filter(f); + } + apr_brigade_cleanup(b); + } + rv = ap_pass_brigade(f->next, b2); - if (rv != APR_SUCCESS) { - goto out; - } + apr_brigade_cleanup(b2); ctx->headers_sent = 1; - if (r->header_only || AP_STATUS_IS_HEADER_ONLY(r->status)) { - apr_brigade_cleanup(b); + if (rv != APR_SUCCESS || header_only) { goto out; }