From: Ruediger Pluem Date: Sat, 21 Jan 2006 23:22:23 +0000 (+0000) Subject: * Improve fix for PR38123. This fixes PR38123 and PR37790 (whose fix has been X-Git-Tag: 2.3.0~2586 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4befe875041ceaa3c2841e2b5d8ad815676bcdb8;p=apache * Improve fix for PR38123. This fixes PR38123 and PR37790 (whose fix has been already backported) by inserting the HTTP_IN filter uncondionally before we call ap_send_error_response or ap_die. This ensures that ap_discard_request_body called by ap_die and by ap_send_error_response works correctly on status codes that do not cause the connection to be dropped and in situations where the connection should be kept alive. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@371132 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/protocol.c b/server/protocol.c index 9934f0a66d..e42e280776 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -902,6 +902,16 @@ static request_rec *request_post_read(request_rec *r, conn_rec *conn) "(see RFC2616 section 14.23): %s", r->uri); } + /* + * Add the HTTP_IN filter here to ensure that ap_discard_request_body + * called by ap_die and by ap_send_error_response works correctly on + * status codes that do not cause the connection to be dropped and + * in situations where the connection should be kept alive. + */ + + ap_add_input_filter_handle(ap_http_input_filter_handle, + NULL, r, r->connection); + if (r->status != HTTP_OK) { ap_send_error_response(r, 0); ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, r); @@ -910,8 +920,6 @@ static request_rec *request_post_read(request_rec *r, conn_rec *conn) } if ((access_status = ap_run_post_read_request(r))) { - ap_add_input_filter_handle(ap_http_input_filter_handle, - NULL, r, r->connection); ap_die(access_status, r); ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, r); ap_run_log_transaction(r); @@ -934,8 +942,6 @@ static request_rec *request_post_read(request_rec *r, conn_rec *conn) ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "client sent an unrecognized expectation value of " "Expect: %s", expect); - ap_add_input_filter_handle(ap_http_input_filter_handle, - NULL, r, r->connection); ap_send_error_response(r, 0); ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, r); ap_run_log_transaction(r); @@ -943,8 +949,6 @@ static request_rec *request_post_read(request_rec *r, conn_rec *conn) } } - ap_add_input_filter_handle(ap_http_input_filter_handle, - NULL, r, r->connection); return r; }