|
|
320bd5 |
diff --git a/modules/http/http_request.c b/modules/http/http_request.c
|
|
|
320bd5 |
index c97dc77..9885de4 100644
|
|
|
320bd5 |
--- a/modules/http/http_request.c
|
|
|
320bd5 |
+++ b/modules/http/http_request.c
|
|
|
320bd5 |
@@ -227,11 +227,21 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
|
|
|
320bd5 |
ap_die_r(type, r, r->status);
|
|
|
320bd5 |
}
|
|
|
320bd5 |
|
|
|
320bd5 |
-static void check_pipeline(conn_rec *c)
|
|
|
320bd5 |
+#define RETRIEVE_BRIGADE_FROM_POOL(bb, key, pool, allocator) do { \
|
|
|
320bd5 |
+ apr_pool_userdata_get((void **)&bb, key, pool); \
|
|
|
320bd5 |
+ if (bb == NULL) { \
|
|
|
320bd5 |
+ bb = apr_brigade_create(pool, allocator); \
|
|
|
320bd5 |
+ apr_pool_userdata_setn((const void *)bb, key, NULL, pool); \
|
|
|
320bd5 |
+ } \
|
|
|
320bd5 |
+ else { \
|
|
|
320bd5 |
+ apr_brigade_cleanup(bb); \
|
|
|
320bd5 |
+ } \
|
|
|
320bd5 |
+} while(0)
|
|
|
320bd5 |
+
|
|
|
320bd5 |
+static void check_pipeline(conn_rec *c, apr_bucket_brigade *bb)
|
|
|
320bd5 |
{
|
|
|
320bd5 |
if (c->keepalive != AP_CONN_CLOSE) {
|
|
|
320bd5 |
apr_status_t rv;
|
|
|
320bd5 |
- apr_bucket_brigade *bb = apr_brigade_create(c->pool, c->bucket_alloc);
|
|
|
320bd5 |
|
|
|
320bd5 |
rv = ap_get_brigade(c->input_filters, bb, AP_MODE_SPECULATIVE,
|
|
|
320bd5 |
APR_NONBLOCK_READ, 1);
|
|
|
320bd5 |
@@ -245,11 +255,10 @@ static void check_pipeline(conn_rec *c)
|
|
|
320bd5 |
else {
|
|
|
320bd5 |
c->data_in_input_filters = 1;
|
|
|
320bd5 |
}
|
|
|
320bd5 |
- apr_brigade_destroy(bb);
|
|
|
320bd5 |
+ apr_brigade_cleanup(bb);
|
|
|
320bd5 |
}
|
|
|
320bd5 |
}
|
|
|
320bd5 |
|
|
|
320bd5 |
-
|
|
|
320bd5 |
AP_DECLARE(void) ap_process_request_after_handler(request_rec *r)
|
|
|
320bd5 |
{
|
|
|
320bd5 |
apr_bucket_brigade *bb;
|
|
|
320bd5 |
@@ -260,11 +269,13 @@ AP_DECLARE(void) ap_process_request_after_handler(request_rec *r)
|
|
|
320bd5 |
* this bucket is destroyed, the request will be logged and
|
|
|
320bd5 |
* its pool will be freed
|
|
|
320bd5 |
*/
|
|
|
320bd5 |
- bb = apr_brigade_create(r->connection->pool, r->connection->bucket_alloc);
|
|
|
320bd5 |
+ RETRIEVE_BRIGADE_FROM_POOL(bb, "ap_process_request_after_handler_brigade",
|
|
|
320bd5 |
+ c->pool, c->bucket_alloc);
|
|
|
320bd5 |
b = ap_bucket_eor_create(r->connection->bucket_alloc, r);
|
|
|
320bd5 |
APR_BRIGADE_INSERT_HEAD(bb, b);
|
|
|
320bd5 |
|
|
|
320bd5 |
ap_pass_brigade(r->connection->output_filters, bb);
|
|
|
320bd5 |
+ apr_brigade_cleanup(bb);
|
|
|
320bd5 |
|
|
|
320bd5 |
/* From here onward, it is no longer safe to reference r
|
|
|
320bd5 |
* or r->pool, because r->pool may have been destroyed
|
|
|
320bd5 |
@@ -273,7 +284,7 @@ AP_DECLARE(void) ap_process_request_after_handler(request_rec *r)
|
|
|
320bd5 |
|
|
|
320bd5 |
if (c->cs)
|
|
|
320bd5 |
c->cs->state = CONN_STATE_WRITE_COMPLETION;
|
|
|
320bd5 |
- check_pipeline(c);
|
|
|
320bd5 |
+ check_pipeline(c, bb);
|
|
|
320bd5 |
AP_PROCESS_REQUEST_RETURN((uintptr_t)r, r->uri, r->status);
|
|
|
320bd5 |
if (ap_extended_status) {
|
|
|
320bd5 |
ap_time_process_request(c->sbh, STOP_PREQUEST);
|
|
|
320bd5 |
@@ -363,7 +374,8 @@ void ap_process_request(request_rec *r)
|
|
|
320bd5 |
ap_process_async_request(r);
|
|
|
320bd5 |
|
|
|
320bd5 |
if (!c->data_in_input_filters) {
|
|
|
320bd5 |
- bb = apr_brigade_create(c->pool, c->bucket_alloc);
|
|
|
320bd5 |
+ RETRIEVE_BRIGADE_FROM_POOL(bb, "ap_process_request_after_handler_brigade",
|
|
|
320bd5 |
+ c->pool, c->bucket_alloc);
|
|
|
320bd5 |
b = apr_bucket_flush_create(c->bucket_alloc);
|
|
|
320bd5 |
APR_BRIGADE_INSERT_HEAD(bb, b);
|
|
|
320bd5 |
rv = ap_pass_brigade(c->output_filters, bb);
|
|
|
320bd5 |
@@ -380,6 +392,7 @@ void ap_process_request(request_rec *r)
|
|
|
320bd5 |
"Timeout while writing data for URI %s to the"
|
|
|
320bd5 |
" client", r->unparsed_uri);
|
|
|
320bd5 |
}
|
|
|
320bd5 |
+ apr_brigade_cleanup(bb);
|
|
|
320bd5 |
}
|
|
|
320bd5 |
if (ap_extended_status) {
|
|
|
320bd5 |
ap_time_process_request(c->sbh, STOP_PREQUEST);
|