Commit 2b31b578 authored by Eric Covener's avatar Eric Covener
Browse files

Merge r722213,r722081, and r721679 from trunk:

* Avoid sending no answer at all if a custom error page causes an
  AP_FILTER_ERROR.

* allow ap_invoke_handler() to pass-through AP_FILTER_ERROR as if it were
  a reserved status code (OK/DECLINED/SUSPENDED). Prevents ap_die() from seeing a
  500 error when the http header filter has already taken care of the proper
  error response

* To be safe, consume the entire brigade after processing an error bucket in
  the HTTP output filter.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@722642 13f79535-47bb-0310-9956-ffa450edef68
parent d988d6c7
Loading
Loading
Loading
Loading
+10 −0
Changes for CHANGES: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
                                                         -*- coding: utf-8 -*-
Changes with Apache 2.2.11

  *) core: When the ap_http_header_filter processes an error bucket, cleanup
     the passed brigade before returning AP_FILTER_ERROR down the filter 
     chain. This unambiguously ensures the same error bucket isn't revisited
     [Ruediger Pluem]

  *) core: Error responses set by filters were being coerced into 500 errors,
     sometimes appended to the original error response. Log entry of:
     'Handler for (null) returned invalid result code -3'
     [Eric Covener]

  *) configure: Don't reject libtool 2.x
     PR 44817 [Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA gmail.com>]

+0 −21
Changes for STATUS: 0 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -86,27 +86,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

   * core: Allow ap_invoke_handler to pass AP_FILTER_ERROR through as if it
     were a reserved return code (OK/DECLINED) instead of converting it to 
     internal server error. 
     Additionally:
       * Clear the brigade in ap_http_header_filter when handling an error bucket.
       * Avoid sending no answer at all if a custom error page causes 
         an AP_FILTER_ERROR.
      Trunk version of patch:
        http://svn.apache.org/viewvc?rev=721679&view=rev
        http://svn.apache.org/viewvc?rev=722081&view=rev
        http://svn.apache.org/viewvc?rev=722213&view=rev
      Backport version for 2.2.x of updated patch:
        http://people.apache.org/~covener/2.2.x-ap_filter_error+722081+722213.diff
      +1: covener, rpluem, niq
      rpluem says: 1. There is a bogus entry in your patch to CHANGES
                   2. I guess we should also consider r722213, because
                      with the current state of the patch we IMHO create
                      a regression in the case that a custom error page
                      results in AP_FILTER_ERROR before sending the page.
      covener says: r722213 added and extra CHANGES entry removed (reset niq's +1)

PATCHES PROPOSED TO BACKPORT FROM TRUNK:
  [ New proposals should be added at the end of the list ]

+5 −1
Changes for modules/http/http_filters.c: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -1135,7 +1135,11 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
        }
    }
    if (eb) {
        ap_die(eb->status, r);
        int status;

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

+24 −0
Changes for modules/http/http_request.c: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -80,8 +80,32 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
    request_rec *r_1st_err = r;

    if (type == AP_FILTER_ERROR) {
        ap_filter_t *next;

        /*
         * Check if we still have the ap_http_header_filter in place. If
         * this is the case we should not ignore AP_FILTER_ERROR here because
         * it means that we have not sent any response at all and never
         * will. This is bad. Sent an internal server error instead.
         */
        next = r->output_filters;
        while (next && (next->frec != ap_http_header_filter_handle)) {
               next = next->next;
        }

        /*
         * If next != NULL then we left the while above because of
         * next->frec == ap_http_header_filter
         */
        if (next) {
            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                          "Custom error page caused AP_FILTER_ERROR");
            type = HTTP_INTERNAL_SERVER_ERROR;
        }
        else {
            return;
        }
    }

    if (type == DONE) {
        ap_finalize_request_protocol(r);
+1 −0
Changes for server/config.c: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -378,6 +378,7 @@ AP_CORE_DECLARE(int) ap_invoke_handler(request_rec *r)
            "handler \"%s\" not found for: %s", r->handler, r->filename);
    }
    if ((result != OK) && (result != DONE) && (result != DECLINED)
        && (result != AP_FILTER_ERROR)
        && !ap_is_HTTP_VALID_RESPONSE(result)) {
        /* If a module is deliberately returning something else
         * (request_rec in non-HTTP or proprietary extension?)