Commit 80b6c944 authored by Ryan Bloom's avatar Ryan Bloom
Browse files

Cleanup the error bucket code a bit. This uses the error bucket directly

instead of using ap_bucket_read.  It also lets ap_die handle the fact that
the filter returned the error.
Submitted by:	Greg Stein


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87867 13f79535-47bb-0310-9956-ffa450edef68
parent 022cf1b1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -79,8 +79,8 @@ AP_DECLARE(apr_bucket *) ap_bucket_make_error(apr_bucket *b, int error,
    if (h == NULL) {
        return NULL;
    }

    h->start = apr_psprintf(p, "%d %s", error, buf);
    h->status = error;
    h->start = apr_pstrdup(p, buf);

    b->length = strlen(h->start);
    b->type = &ap_bucket_type_error;
+7 −6
Original line number Diff line number Diff line
@@ -2466,13 +2466,14 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_b
        return OK;
    }

    APR_BRIGADE_FOREACH(e, b) {
        if (APR_BRIGADE_FIRST(b)->type == &ap_bucket_type_error) {
        const char *str;
        apr_size_t length;
        apr_bucket_read(APR_BRIGADE_FIRST(b), &str, &length, APR_NONBLOCK_READ);
        ap_die(atoi(ap_getword_white(r->pool, &str)), r);
            ap_bucket_error *eb = e->data;

            ap_die(eb->status, r);
            return AP_FILTER_ERROR;
        }
    }

    if (r->assbackwards) {
        r->bytes_sent = 0;
+5 −1
Original line number Diff line number Diff line
@@ -1085,6 +1085,10 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
    char *custom_response = ap_response_code_string(r, error_index);
    int recursive_error = 0;

    if (type == AP_FILTER_ERROR) {
        return;
    }

    if (type == DONE) {
        ap_finalize_request_protocol(r);
        return;
@@ -1351,7 +1355,7 @@ static void process_request_internal(request_rec *r)
     */
    ap_run_insert_filter(r);

    if ((access_status = ap_invoke_handler(r)) != 0 && access_status != -3) {
    if ((access_status = ap_invoke_handler(r)) != 0) {
        ap_die(access_status, r);
        return;
    }