summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Eissing <icing@apache.org>2021-08-30 12:05:06 +0200
committerStefan Eissing <icing@apache.org>2021-08-30 12:05:06 +0200
commit0fd0275c1870ae8197677f9ecb4a0003d08413d0 (patch)
tree898fab04974d691ac37a5b6302fe92846a0c3d6e
parentAdd HTTP/2 test job to Travis configuration. (diff)
downloadapache2-0fd0275c1870ae8197677f9ecb4a0003d08413d0.tar.xz
apache2-0fd0275c1870ae8197677f9ecb4a0003d08413d0.zip
* mod_deflate: refrain from reading buckets of known length, just
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
-rw-r--r--modules/filters/mod_deflate.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c
index 207617b352..102d54f583 100644
--- a/modules/filters/mod_deflate.c
+++ b/modules/filters/mod_deflate.c
@@ -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)