mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
* Use new ap_proxy_buckets_lifetime_transform
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726782 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -671,56 +671,6 @@ static int spool_reqbody_cl(apr_pool_t *p,
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Transform buckets from one bucket allocator to another one by creating a
|
||||
* transient bucket for each data bucket and let it use the data read from
|
||||
* the old bucket. Metabuckets are transformed by just recreating them.
|
||||
* Attention: Currently only the following bucket types are handled:
|
||||
*
|
||||
* All data buckets
|
||||
* FLUSH
|
||||
* EOS
|
||||
*
|
||||
* If an other bucket type is found its type is logged as a debug message
|
||||
* and APR_EGENERAL is returned.
|
||||
*/
|
||||
static apr_status_t proxy_buckets_lifetime_transform(request_rec *r,
|
||||
apr_bucket_brigade *from, apr_bucket_brigade *to)
|
||||
{
|
||||
apr_bucket *e;
|
||||
apr_bucket *new;
|
||||
const char *data;
|
||||
apr_size_t bytes;
|
||||
apr_status_t rv = APR_SUCCESS;
|
||||
apr_bucket_alloc_t *bucket_alloc = to->bucket_alloc;
|
||||
|
||||
apr_brigade_cleanup(to);
|
||||
for (e = APR_BRIGADE_FIRST(from);
|
||||
e != APR_BRIGADE_SENTINEL(from);
|
||||
e = APR_BUCKET_NEXT(e)) {
|
||||
if (!APR_BUCKET_IS_METADATA(e)) {
|
||||
apr_bucket_read(e, &data, &bytes, APR_BLOCK_READ);
|
||||
new = apr_bucket_transient_create(data, bytes, bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(to, new);
|
||||
}
|
||||
else if (APR_BUCKET_IS_FLUSH(e)) {
|
||||
new = apr_bucket_flush_create(bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(to, new);
|
||||
}
|
||||
else if (APR_BUCKET_IS_EOS(e)) {
|
||||
new = apr_bucket_eos_create(bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(to, new);
|
||||
}
|
||||
else {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00964)
|
||||
"Unhandled bucket type of type %s in"
|
||||
" proxy_buckets_lifetime_transform", e->type->name);
|
||||
rv = APR_EGENERAL;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
enum rb_methods {
|
||||
RB_INIT = 0,
|
||||
RB_STREAM_CL,
|
||||
@@ -1851,7 +1801,7 @@ int ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
||||
}
|
||||
|
||||
/* Switch the allocator lifetime of the buckets */
|
||||
proxy_buckets_lifetime_transform(r, bb, pass_bb);
|
||||
ap_proxy_buckets_lifetime_transform(r, bb, pass_bb);
|
||||
|
||||
/* found the last brigade? */
|
||||
if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(pass_bb))) {
|
||||
|
Reference in New Issue
Block a user