]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Trying to tie up some loose ends:
authorDaniel Gruno <humbedooh@apache.org>
Mon, 27 Aug 2012 13:57:43 +0000 (13:57 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Mon, 27 Aug 2012 13:57:43 +0000 (13:57 +0000)
- 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

index c84c54c79742263778e94571bc86b5e4f9b69660..e75ca32ddf17b56b42be1703bf6e7a64e1a07c59 100644 (file)
@@ -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;