]> granicus.if.org Git - apache/commitdiff
Don't try to compress/decompress where there's a Content-Range.
authorNick Kew <niq@apache.org>
Mon, 6 Aug 2007 14:37:42 +0000 (14:37 +0000)
committerNick Kew <niq@apache.org>
Mon, 6 Aug 2007 14:37:42 +0000 (14:37 +0000)
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.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@563154 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_deflate.c

index 365a8378fec8a77f0e77fb22eb31c0636bcf7474..959bdc15703df4a2f26aee61e539bdff2ee0e3bc 100644 (file)
@@ -387,6 +387,12 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
             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
@@ -715,6 +721,12 @@ static apr_status_t deflate_in_filter(ap_filter_t *f,
             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 +751,6 @@ static apr_status_t deflate_in_filter(ap_filter_t *f,
 
         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 +979,12 @@ static apr_status_t inflate_out_filter(ap_filter_t *f,
             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.
@@ -986,7 +1003,6 @@ static apr_status_t inflate_out_filter(ap_filter_t *f,
        /* 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);