[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-cvs
Subject:    svn commit: r958253 - /httpd/httpd/trunk/modules/filters/mod_deflate.c
From:       sf () apache ! org
Date:       2010-06-26 17:41:01
Message-ID: 20100626174102.09E2B2388903 () eris ! apache ! org
[Download RAW message or body]

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)) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic