From: Ryan Bloom Date: Sat, 27 Jan 2001 17:17:51 +0000 (+0000) Subject: Cleanup the error bucket code a bit. This uses the error bucket directly X-Git-Tag: APACHE_2_0_BETA_CANDIDATE_1~80 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4265b4294a098f558bc1f6f22ad071c96d16991;p=apache 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 --- diff --git a/modules/http/error_bucket.c b/modules/http/error_bucket.c index 5e60c3a8de..d59439b546 100644 --- a/modules/http/error_bucket.c +++ b/modules/http/error_bucket.c @@ -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; diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index c6c1ddc825..e6b4a7af0d 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -2466,12 +2466,13 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_b return OK; } - 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); - return AP_FILTER_ERROR; + APR_BRIGADE_FOREACH(e, b) { + if (APR_BRIGADE_FIRST(b)->type == &ap_bucket_type_error) { + ap_bucket_error *eb = e->data; + + ap_die(eb->status, r); + return AP_FILTER_ERROR; + } } if (r->assbackwards) { diff --git a/modules/http/http_request.c b/modules/http/http_request.c index a98bae9356..af289b71f7 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -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; }