From 1bb2c214cdc335f3f855c9e77f5748a017e555a3 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Thu, 2 Dec 2004 13:45:32 +0000 Subject: [PATCH] * modules/filters/mod_deflate.c (deflate_out_filter): Check explicitly for a 304 or 204 response rather than a brigade which begins with EOS, to correctly handle such responses when generated by a CGI script. Don't alter the headers for this case either. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@109500 13f79535-47bb-0310-9956-ffa450edef68 --- modules/filters/mod_deflate.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 5b16371b06..550b514ae8 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -350,19 +350,9 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, } } - /* Deflating a zero-length response would make it longer; the - * proxy may pass through an empty response for a 304 too. - * So we just need to fix up the headers as if we had a body. - */ - if (APR_BUCKET_IS_EOS(APR_BRIGADE_FIRST(bb))) { - if (!encoding || !strcasecmp(encoding, "identity")) { - apr_table_set(r->headers_out, "Content-Encoding", "gzip"); - } - else { - apr_table_merge(r->headers_out, "Content-Encoding", "gzip"); - } - apr_table_unset(r->headers_out, "Content-Length"); - + /* For a 304 or 204 response there is no entity included in + * the response and hence nothing to deflate. */ + if (r->status == HTTP_NOT_MODIFIED || r->status == HTTP_NO_CONTENT) { ap_remove_output_filter(f); return ap_pass_brigade(f->next, bb); } -- 2.50.1