From 41319e02386e427f1d4bdc6a63c067dc85d5371f Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Tue, 23 Jan 2001 07:30:11 +0000 Subject: [PATCH] Fix the byterange filter for the case where the bucket can't be copied natively. This will only ever happen if a bucket can be split but not copied, because we read the bucket in apr_brigade_partition if we can't split it. Regardless, this is much safer. This should also fix all of the problems with the byterange filter. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87793 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_protocol.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index f64a1d9ef3..c0b8da5c09 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -325,7 +325,13 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( ec = e; do { apr_bucket *foo; - apr_bucket_copy(ec, &foo); + const char *str; + apr_size_t len; + + if (apr_bucket_copy(ec, &foo) != APR_SUCCESS) { + apr_bucket_read(ec, &str, &len, APR_BLOCK_READ); + foo = apr_bucket_create_heap(str, len, 0, NULL); + } APR_BRIGADE_INSERT_TAIL(bsend, foo); ec = APR_BUCKET_NEXT(ec); } while (ec != e2); -- 2.40.0