httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1162858 - in /httpd/httpd/branches/2.2.x: STATUS modules/filters/mod_deflate.c
Date Mon, 29 Aug 2011 15:22:22 GMT
Author: jim
Date: Mon Aug 29 15:22:22 2011
New Revision: 1162858

URL: http://svn.apache.org/viewvc?rev=1162858&view=rev
Log:
Merge r958253 from trunk:

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

Submitted by: sf
Reviewed/backported by: jim


Modified:
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1162858&r1=1162857&r2=1162858&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Mon Aug 29 15:22:22 2011
@@ -92,12 +92,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * mod_deflate: Stop compressing HEAD requests if there is not Content-Length
-    header
-    Trunk patch: http://svn.apache.org/viewvc?rev=958253&view=rev
-    2.2.x patch: trunk patch works with offset
-    +1: sf, covener, jim
-
   * mod_reqtimeout: Disable keep-alive after read timeout
     Trunk patch: http://svn.apache.org/viewvc?rev=1103213&view=rev
     2.2.x patch: trunk patch works except for CHANGES

Modified: httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c?rev=1162858&r1=1162857&r2=1162858&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c (original)
+++ httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c Mon Aug 29 15:22:22 2011
@@ -582,6 +582,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