]> granicus.if.org Git - apache/commitdiff
* Improve fix for PR38123. This fixes PR38123 and PR37790 (whose fix has been
authorRuediger Pluem <rpluem@apache.org>
Sat, 21 Jan 2006 23:22:23 +0000 (23:22 +0000)
committerRuediger Pluem <rpluem@apache.org>
Sat, 21 Jan 2006 23:22:23 +0000 (23:22 +0000)
  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

server/protocol.c

index 9934f0a66d5e88e875f1f1c3aad4ce2fe94b13f3..e42e280776f0d063901a6b49cab242dd5049ae96 100644 (file)
@@ -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;
 }