]> granicus.if.org Git - apache/commitdiff
Cleanup the error bucket code a bit. This uses the error bucket directly
authorRyan Bloom <rbb@apache.org>
Sat, 27 Jan 2001 17:17:51 +0000 (17:17 +0000)
committerRyan Bloom <rbb@apache.org>
Sat, 27 Jan 2001 17:17:51 +0000 (17:17 +0000)
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

modules/http/error_bucket.c
modules/http/http_protocol.c
modules/http/http_request.c

index 5e60c3a8de015d517e663381e7b88b6d8fc6b944..d59439b546bf392abc39213a6499b151ebfada25 100644 (file)
@@ -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;
index c6c1ddc8256fb86c9e0bceb0627853b4e121a14d..e6b4a7af0dbcd1254b556d782b6a8f745386dc79 100644 (file)
@@ -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) {
index a98bae93568cdcae699589f8b324076201a5300d..af289b71f739769d5606dab77e03a32b8ed15e0c 100644 (file)
@@ -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;
     }