From 5ee40b970d77d8248ac6f844db957b1712c00314 Mon Sep 17 00:00:00 2001 From: Daniel Gruno Date: Mon, 27 Aug 2012 13:57:43 +0000 Subject: [PATCH] Trying to tie up some loose ends: - Return immediately if the return val of ap_pass_brigade != APR_SUCCESS - Return a bit earlier when dealing with input filters, so as to not build up a huge backlog. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1377685 13f79535-47bb-0310-9956-ffa450edef68 --- modules/lua/mod_lua.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/lua/mod_lua.c b/modules/lua/mod_lua.c index c84c54c797..e75ca32ddf 100644 --- a/modules/lua/mod_lua.c +++ b/modules/lua/mod_lua.c @@ -390,6 +390,7 @@ static apr_status_t lua_output_filter_handle(ap_filter_t *f, apr_bucket_brigade lua_filter_ctx* ctx; conn_rec *c = r->connection; apr_bucket *pbktIn; + apr_status_t rv; /* Set up the initial filter context and acquire the function. * The corresponding Lua function should yield here. @@ -433,8 +434,11 @@ static apr_status_t lua_output_filter_handle(ap_filter_t *f, apr_bucket_brigade pbktOut = apr_bucket_heap_create(output, olen, NULL, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->tmpBucket, pbktOut); - ap_pass_brigade(f->next, ctx->tmpBucket); + rv = ap_pass_brigade(f->next, ctx->tmpBucket); apr_brigade_cleanup(ctx->tmpBucket); + if (rv != APR_SUCCESS) { + return rv; + } } else { ctx->broken = 1; @@ -462,7 +466,11 @@ static apr_status_t lua_output_filter_handle(ap_filter_t *f, apr_bucket_brigade pbktEOS = apr_bucket_eos_create(c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->tmpBucket, pbktEOS); ap_lua_release_state(L, ctx->spec, r); - ap_pass_brigade(f->next, ctx->tmpBucket); + rv = ap_pass_brigade(f->next, ctx->tmpBucket); + apr_brigade_cleanup(ctx->tmpBucket); + if (rv != APR_SUCCESS) { + return rv; + } } } /* Clean up */ @@ -549,6 +557,7 @@ static apr_status_t lua_input_filter_handle(ap_filter_t *f, pbktOut = apr_bucket_heap_create(output, olen, 0, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(pbbOut, pbktOut); apr_bucket_delete(pbktIn); + return APR_SUCCESS; } else { ctx->broken = 1;