Commit fbc05d40 authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

core, modules: Avoid error response/document handling by the core if some

handler or input filter already did it while reading the request (causing
a double response body).

Submitted by: ylavic
Backports: r1482522 (partial, ap_map_http_request_error() things only!),
           r1529988, r1529991, r1643537, r1643543, r1657897, r1665625,
           r1665721, r1674056
Reviewed by: ylavic, wrowe, covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1683808 13f79535-47bb-0310-9956-ffa450edef68
parent 0c7c8969
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
                                                         -*- coding: utf-8 -*-
Changes with Apache 2.2.30

  *) http: Make ap_die() robust against any HTTP error code and not modify
     response status (finally logged) when nothing is to be done. [Yann Ylavic]

  *) core, modules: Avoid error response/document handling by the core if some
     handler or input filter already did it while reading the request (causing
     a double response body).  [Yann Ylavic]

  *) FreeBSD: Disable IPv4-mapped listening sockets by default for versions
     5+ instead of just for FreeBSD 5. PR 53824.  [Jeff Trawick,
     Olli Hauer <ohauer gmx de>]
+0 −17
Original line number Diff line number Diff line
@@ -109,23 +109,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
                  (modulo CHANGES)
     +1: ylavic, wrowe, covener

  *) core, modules: Avoid error response/document handling by the core if some
     handler or input filter already did it while reading the request (causing
     a double response body).
     trunk patch: http://svn.apache.org/r1482522 (partial, ap_map_http_request_error() things only!)
                  http://svn.apache.org/r1529988
                  http://svn.apache.org/r1529991
                  http://svn.apache.org/r1643537
                  http://svn.apache.org/r1643543
                  http://svn.apache.org/r1657897
                  http://svn.apache.org/r1665625
                  http://svn.apache.org/r1665721
                  http://svn.apache.org/r1674056
     2.4.x patch: http://people.apache.org/~ylavic/httpd-2.4.x-ap_map_http_request_error-v2.patch
     2.2.x patch: http://people.apache.org/~ylavic/httpd-2.2.x-ap_map_http_request_error-v2.patch
     +1: ylavic, wrowe, covener
     ylavic: Depends on httpd-2.2.x-ap_die.patch above.


PATCHES PROPOSED TO BACKPORT FROM TRUNK:
  [ New proposals should be added at the end of the list ]
+2 −1
Original line number Diff line number Diff line
@@ -157,6 +157,7 @@
 * 20051115.37 (2.2.30) Add ap_get_server_name_for_url()
 * 20051115.38 (2.2.30) Add ap_proxy_set_scoreboard_lb() in mod_proxy.h
 * 20051115.39 (2.2.30) Add ap_proxy_connection_reusable()
 * 20051115.40 (2.2.30) Add ap_map_http_request_error()
 */

#define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
@@ -164,7 +165,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20051115
#endif
#define MODULE_MAGIC_NUMBER_MINOR 39                    /* 0...n */
#define MODULE_MAGIC_NUMBER_MINOR 40                    /* 0...n */

/**
 * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
+17 −0
Original line number Diff line number Diff line
@@ -432,6 +432,23 @@ AP_DECLARE(int) ap_should_client_block(request_rec *r);
 */
AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz);

/*
 * Map specific APR codes returned by the filter stack to HTTP error
 * codes, or the default status code provided. Use it as follows:
 *
 * return ap_map_http_request_error(rv, HTTP_BAD_REQUEST);
 *
 * If the filter has already handled the error, AP_FILTER_ERROR will
 * be returned, which is cleanly passed through.
 *
 * These mappings imply that the filter stack is reading from the
 * downstream client, the proxy will map these codes differently.
 * @param rv APR status code
 * @param status Default HTTP code should the APR code not be recognised
 * @return Mapped HTTP status code
 */
AP_DECLARE(int) ap_map_http_request_error(apr_status_t rv, int status);

/**
 * In HTTP/1.1, any method can have a body.  However, most GET handlers
 * wouldn't know what to do with a request body if they received one.
+2 −2
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ static int mmap_handler(request_rec *r, a_file *file)
    APR_BRIGADE_INSERT_TAIL(bb, b);

    if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS)
        return HTTP_INTERNAL_SERVER_ERROR;
        return AP_FILTER_ERROR;
#endif
    return OK;
}
@@ -304,7 +304,7 @@ static int sendfile_handler(request_rec *r, a_file *file)
    APR_BRIGADE_INSERT_TAIL(bb, b);

    if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS)
        return HTTP_INTERNAL_SERVER_ERROR;
        return AP_FILTER_ERROR;
#endif
    return OK;
}
Loading