Commit 5ce7a6ca authored by Ruediger Pluem's avatar Ruediger Pluem
Browse files

* Use send_bucket_downstream to send data down the chain instead of creating

  a brigade each time.

PR: 45687
Submitted by: Dan Poirier <poirier pobox.com>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@693577 13f79535-47bb-0310-9956-ffa450edef68
parent a87fc26d
Loading
Loading
Loading
Loading
+3 −0
Changes for CHANGES: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,9 @@
Changes with Apache 2.3.0
[ When backported to 2.2.x, remove entry from this file ]

  *) mod_charset_lite: Avoid dropping error responses by handling meta buckets
     correctly. PR 45687 [Dan Poirier <poirier pobox.com>]

  *) mod_authnz_ldap: don't return NULL-valued environment variables to
     other modules.  PR 39045 [Francois Pesce <francois.pesce gmail.com>]

+15 −24
Changes for modules/filters/mod_charset_lite.c: 15 added lines, 24 removed lines.
Original line number Diff line number Diff line
@@ -376,6 +376,20 @@ static void xlate_insert_filter(request_rec *r)
 *   will be generated
 */

static apr_status_t send_bucket_downstream(ap_filter_t *f, apr_bucket *b)
{
    charset_filter_ctx_t *ctx = f->ctx;
    apr_status_t rv;

    APR_BRIGADE_INSERT_TAIL(ctx->tmpbb, b);
    rv = ap_pass_brigade(f->next, ctx->tmpbb);
    if (rv != APR_SUCCESS) {
        ctx->ees = EES_DOWNSTREAM;
    }
    apr_brigade_cleanup(ctx->tmpbb);
    return rv;
}

/* send_downstream() is passed the translated data; it puts it in a single-
 * bucket brigade and passes the brigade to the next filter
 */
@@ -383,19 +397,10 @@ static apr_status_t send_downstream(ap_filter_t *f, const char *tmp, apr_size_t
{
    request_rec *r = f->r;
    conn_rec *c = r->connection;
    apr_bucket_brigade *bb;
    apr_bucket *b;
    charset_filter_ctx_t *ctx = f->ctx;
    apr_status_t rv;

    bb = apr_brigade_create(r->pool, c->bucket_alloc);
    b = apr_bucket_transient_create(tmp, len, c->bucket_alloc);
    APR_BRIGADE_INSERT_TAIL(bb, b);
    rv = ap_pass_brigade(f->next, bb);
    if (rv != APR_SUCCESS) {
        ctx->ees = EES_DOWNSTREAM;
    }
    return rv;
    return send_bucket_downstream(f, b);
}

static apr_status_t send_eos(ap_filter_t *f)
@@ -417,20 +422,6 @@ static apr_status_t send_eos(ap_filter_t *f)
    return rv;
}

static apr_status_t send_bucket_downstream(ap_filter_t *f, apr_bucket *b)
{
    charset_filter_ctx_t *ctx = f->ctx;
    apr_status_t rv;

    APR_BRIGADE_INSERT_TAIL(ctx->tmpbb, b);
    rv = ap_pass_brigade(f->next, ctx->tmpbb);
    if (rv != APR_SUCCESS) {
        ctx->ees = EES_DOWNSTREAM;
    }
    apr_brigade_cleanup(ctx->tmpbb);
    return rv;
}

static apr_status_t set_aside_partial_char(charset_filter_ctx_t *ctx,
                                           const char *partial,
                                           apr_size_t partial_len)