]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* mod_deflate: refrain from reading buckets of known length, just
authorStefan Eissing <icing@apache.org>
Mon, 30 Aug 2021 10:05:06 +0000 (10:05 +0000)
committerStefan Eissing <icing@apache.org>
Mon, 30 Aug 2021 10:05:06 +0000 (10:05 +0000)
   to get their length. This may transform buckets unwanted (e.g. file
   to mmap) and prevent optimization down the filter chain.

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

modules/filters/mod_deflate.c

index 207617b35255cbb3dfba10462fc7687cc12bc0cf..102d54f5834acb2c0bd17faecbabc1e99c8e0c45 100644 (file)
@@ -623,9 +623,14 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
                     continue;
                 }
 
-                rc = apr_bucket_read(e, &data, &blen, APR_BLOCK_READ);
-                if (rc != APR_SUCCESS)
-                    return rc;
+                if (e->length == (apr_size_t)-1) {
+                    rc = apr_bucket_read(e, &data, &blen, APR_BLOCK_READ);
+                    if (rc != APR_SUCCESS)
+                        return rc;
+                }
+                else {
+                    blen = e->length;
+                }
                 len += blen;
                 /* 50 is for Content-Encoding and Vary headers and ETag suffix */
                 if (len > sizeof(gzip_header) + VALIDATION_SIZE + 50)