You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2007/08/07 00:45:40 UTC

svn commit: r563317 - in /httpd/httpd/trunk: CHANGES modules/filters/mod_deflate.c

Author: niq
Date: Mon Aug  6 15:45:39 2007
New Revision: 563317

URL: http://svn.apache.org/viewvc?view=rev&rev=563317
Log:
Check all sources of Content-Encoding in inflate_out filter
PR 42993
Reasoning: http://marc.info/?l=apache-httpd-dev&m=118643107831358&w=2

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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?view=diff&rev=563317&r1=563316&r2=563317
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Aug  6 15:45:39 2007
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) mod_deflate: fix content_encoding detection in inflate_out filter
+     when it's not in response headers table.
+     PR 42993 [Nick Kew]
+
   *) mod_proxy: Improve network performance by setting APR_TCP_NODELAY
      (disable Nagle algorithm) on sockets if implemented.
      PR 42871 [Christian BOITEL <christian_boitel yahoo.fr>, Jim Jagielski]

Modified: httpd/httpd/trunk/modules/filters/mod_deflate.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_deflate.c?view=diff&rev=563317&r1=563316&r2=563317
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_deflate.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_deflate.c Mon Aug  6 15:45:39 2007
@@ -88,10 +88,18 @@
  * If a request has multiple encodings, we need the gzip
  * to be the outermost non-identity encoding.
  */
-static int check_gzip(apr_pool_t *pool, apr_table_t *hdrs)
+static int check_gzip(apr_pool_t *pool, apr_table_t *hdrs,
+                      apr_table_t *hdrs2, const char *enc_in)
 {
     int found = 0;
     const char *encoding = apr_table_get(hdrs, "Content-Encoding");
+
+    if (!encoding && (hdrs2 != NULL)) {
+        encoding = apr_table_get(hdrs2, "Content-Encoding");
+    }
+    if (!encoding) {
+        encoding = enc_in;
+    }
     if (encoding && *encoding) {
 
         /* check the usual/simple case first */
@@ -735,7 +743,7 @@
          *
          * If not, we just remove ourself.
          */
-        if (check_gzip(r->pool, r->headers_in) == 0) {
+        if (check_gzip(r->pool, r->headers_in, NULL, NULL) == 0) {
             ap_remove_input_filter(f);
             return ap_get_brigade(f->next, bb, mode, block, readbytes);
         }
@@ -990,7 +998,8 @@
          * Let's see what our current Content-Encoding is.
          * Only inflate if gzipped.
          */
-        if (check_gzip(r->pool, r->headers_out) == 0) {
+        if (check_gzip(r->pool, r->headers_out, r->err_headers_out,
+                       r->content_encoding) == 0) {
             ap_remove_output_filter(f);
             return ap_pass_brigade(f->next, bb);
         }



Re: svn commit: r563317 - in /httpd/httpd/trunk: CHANGES modules/filters/mod_deflate.c

Posted by Nick Kew <ni...@webthing.com>.
On Tue, 07 Aug 2007 21:55:24 +0200
Ruediger Pluem <rp...@apache.org> wrote:

> In the case that we use enc_in we still adjust hdrs and only hdrs.
> It might be needed to unset r->content_encoding in this case.
> And in the case that Content-Encoding is not in hdrs but in hdrs2 we
> we adjust hdrs instead of hdrs2. This sounds wrong to me.

Good catch yet again.  Dammit, I need a break.

Just fixed in r563803.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Re: svn commit: r563317 - in /httpd/httpd/trunk: CHANGES modules/filters/mod_deflate.c

Posted by Ruediger Pluem <rp...@apache.org>.

On 08/07/2007 12:45 AM, niq@apache.org wrote:
> Author: niq
> Date: Mon Aug  6 15:45:39 2007
> New Revision: 563317
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=563317
> Log:
> Check all sources of Content-Encoding in inflate_out filter
> PR 42993
> Reasoning: http://marc.info/?l=apache-httpd-dev&m=118643107831358&w=2
> 
> Modified:
>     httpd/httpd/trunk/CHANGES
>     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?view=diff&rev=563317&r1=563316&r2=563317
> ==============================================================================
> --- httpd/httpd/trunk/modules/filters/mod_deflate.c (original)
> +++ httpd/httpd/trunk/modules/filters/mod_deflate.c Mon Aug  6 15:45:39 2007
> @@ -88,10 +88,18 @@
>   * If a request has multiple encodings, we need the gzip
>   * to be the outermost non-identity encoding.
>   */
> -static int check_gzip(apr_pool_t *pool, apr_table_t *hdrs)
> +static int check_gzip(apr_pool_t *pool, apr_table_t *hdrs,
> +                      apr_table_t *hdrs2, const char *enc_in)
>  {
>      int found = 0;
>      const char *encoding = apr_table_get(hdrs, "Content-Encoding");
> +
> +    if (!encoding && (hdrs2 != NULL)) {
> +        encoding = apr_table_get(hdrs2, "Content-Encoding");
> +    }
> +    if (!encoding) {
> +        encoding = enc_in;
> +    }

In the case that we use enc_in we still adjust hdrs and only hdrs.
It might be needed to unset r->content_encoding in this case.
And in the case that Content-Encoding is not in hdrs but in hdrs2 we
we adjust hdrs instead of hdrs2. This sounds wrong to me.

Regards

RĂ¼diger