On 02/03/2009 12:20 AM, l...@apache.org wrote:
> Author: lars
> Date: Mon Feb  2 23:20:37 2009
> New Revision: 740149
> 
> URL: http://svn.apache.org/viewvc?rev=740149&view=rev
> Log:
> mod_deflate: Fix creation of invalid Etag headers. We now make sure
> that the Etag value is properly quoted when adding the gzip marker.
> PR 39727.
> 
> Modified:
>     httpd/httpd/trunk/CHANGES
>     httpd/httpd/trunk/modules/filters/mod_deflate.c
> 
> Modified: httpd/httpd/trunk/CHANGES

> Modified: httpd/httpd/trunk/modules/filters/mod_deflate.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_deflate.c?rev=740149&r1=740148&r2=740149&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/filters/mod_deflate.c (original)
> +++ httpd/httpd/trunk/modules/filters/mod_deflate.c Mon Feb  2 23:20:37 2009
> @@ -393,10 +393,13 @@
>  static void deflate_check_etag(request_rec *r, const char *transform)
>  {
>      const char *etag = apr_table_get(r->headers_out, "ETag");
> -    if (etag && (((etag[0] != 'W') && (etag[0] !='w')) || (etag[1] != '/'))) 
> {
> -        apr_table_set(r->headers_out, "ETag",
> -                      apr_pstrcat(r->pool, etag, "-", transform, NULL));
> -    }
> +    if ((etag && (strlen(etag) > 2))) {
> +        if (etag[0] == '"') {
> +            etag = apr_pstrndup(r->pool, etag, strlen(etag) - 2);

Shouldn't this be - 1 instead of - 2?
Think about the following ETag: "A"
Its length is 3, but after the apr_pstrndup operation we end up with "
and thus with an ETag of "-gzip".

Regards

RĂ¼diger

Reply via email to