httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r958253 - /httpd/httpd/trunk/modules/filters/mod_deflate.c
Date Sat, 26 Jun 2010 17:41:01 GMT
Author: sf
Date: Sat Jun 26 17:41:01 2010
New Revision: 958253

URL: http://svn.apache.org/viewvc?rev=958253&view=rev
Log:
Stop compressing if we are doing a HEAD request and the content-length filter
can't determine the content-length anyway.

Submitted by: Ruediger Pluem

Modified:
    httpd/httpd/trunk/modules/filters/mod_deflate.c

Modified: httpd/httpd/trunk/modules/filters/mod_deflate.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_deflate.c?rev=958253&r1=958252&r2=958253&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_deflate.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_deflate.c Sat Jun 26 17:41:01 2010
@@ -637,6 +637,19 @@ static apr_status_t deflate_out_filter(a
         apr_bucket *b;
         apr_size_t len;
 
+        /*
+         * Optimization: If we are a HEAD request and bytes_sent is not zero
+         * it means that we have passed the content-length filter once and
+         * have more data to sent. This means that the content-length filter
+         * could not determine our content-length for the response to the
+         * HEAD request anyway (the associated GET request would deliver the
+         * body in chunked encoding) and we can stop compressing.
+         */
+        if (r->header_only && r->bytes_sent) {
+            ap_remove_output_filter(f);
+            return ap_pass_brigade(f->next, bb);
+        }
+
         e = APR_BRIGADE_FIRST(bb);
 
         if (APR_BUCKET_IS_EOS(e)) {



Mime
View raw message