httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r563466 - /httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c
Date Tue, 07 Aug 2007 12:10:53 GMT
Author: jim
Date: Tue Aug  7 05:10:52 2007
New Revision: 563466

URL: http://svn.apache.org/viewvc?view=rev&rev=563466
Log:
Merge r563154, r563229, r563230 from trunk:

Don't try to compress/decompress where there's a Content-Range.
According to RFC2616, the range would have to apply *after*
applying content-encoding, so anything that's been set before
running the deflate filter is going to be broken.



* We already unset Content-Length in the inflate_out_filter. So move the
  comment and unsetting of Content-MD5 in the right place.


* Also unset Content-MD5 in the deflate_out_filter

Reviewed by: jim

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

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?view=diff&rev=563466&r1=563465&r2=563466
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c (original)
+++ httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c Tue Aug  7 05:10:52 2007
@@ -387,6 +387,12 @@
             return ap_pass_brigade(f->next, bb);
         }
 
+        /* We can't operate on Content-Ranges */
+        if (apr_table_get(r->headers_out, "Content-Range") != NULL) {
+            ap_remove_output_filter(f);
+            return ap_pass_brigade(f->next, bb);
+        }
+
         /* Some browsers might have problems with content types
          * other than text/html, so set gzip-only-text/html
          * (with browsermatch) for them
@@ -536,6 +542,7 @@
             apr_table_mergen(r->headers_out, "Content-Encoding", "gzip");
         }
         apr_table_unset(r->headers_out, "Content-Length");
+        apr_table_unset(r->headers_out, "Content-MD5");
 
         /* initialize deflate output buffer */
         ctx->stream.next_out = ctx->buffer;
@@ -715,6 +722,12 @@
             return ap_get_brigade(f->next, bb, mode, block, readbytes);
         }
 
+        /* We can't operate on Content-Ranges */
+        if (apr_table_get(r->headers_in, "Content-Range") != NULL) {
+            ap_remove_input_filter(f);
+            return ap_get_brigade(f->next, bb, mode, block, readbytes);
+        }
+
         /* Check whether request body is gzipped.
          *
          * If it is, we're transforming the contents, invalidating
@@ -739,7 +752,6 @@
 
         apr_table_unset(r->headers_in, "Content-Length");
         apr_table_unset(r->headers_in, "Content-MD5");
-        apr_table_unset(r->headers_in, "Content-Range");
 
         len = 10;
         rv = apr_brigade_flatten(ctx->bb, deflate_hdr, &len);
@@ -968,6 +980,12 @@
             return ap_pass_brigade(f->next, bb);
         }
 
+        /* We can't operate on Content-Ranges */
+        if (apr_table_get(r->headers_out, "Content-Range") != NULL) {
+            ap_remove_output_filter(f);
+            return ap_pass_brigade(f->next, bb);
+        }
+
         /*
          * Let's see what our current Content-Encoding is.
          * Only inflate if gzipped.
@@ -983,11 +1001,6 @@
             return ap_pass_brigade(f->next, bb);
         }
 
-	/* these are unlikely to be set anyway, but ... */
-        apr_table_unset(r->headers_out, "Content-Length");
-        apr_table_unset(r->headers_out, "Content-MD5");
-        apr_table_unset(r->headers_out, "Content-Range");
-
         f->ctx = ctx = apr_pcalloc(f->r->pool, sizeof(*ctx));
         ctx->bb = apr_brigade_create(r->pool, f->c->bucket_alloc);
         ctx->buffer = apr_palloc(r->pool, c->bufferSize);
@@ -1020,7 +1033,9 @@
         apr_pool_cleanup_register(r->pool, ctx, deflate_ctx_cleanup,
                                   apr_pool_cleanup_null);
 
+        /* these are unlikely to be set anyway, but ... */
         apr_table_unset(r->headers_out, "Content-Length");
+        apr_table_unset(r->headers_out, "Content-MD5");
 
         /* initialize inflate output buffer */
         ctx->stream.next_out = ctx->buffer;



Mime
View raw message