
http://svn.apache.org/viewvc?view=revision&revision=888310
https://bugzilla.redhat.com/show_bug.cgi?id=606964

--- httpd-2.2.15/modules/http/http_filters.c.expectnoka
+++ httpd-2.2.15/modules/http/http_filters.c
@@ -331,6 +331,10 @@ apr_status_t ap_http_filter(ap_filter_t 
                 char *tmp;
                 int len;
 
+                /* if we send an interim response, we're no longer
+                 * in a state of expecting one.
+                 */
+                f->r->expecting_100 = 0;
                 tmp = apr_pstrcat(f->r->pool, AP_SERVER_PROTOCOL, " ",
                                   ap_get_status_line(100), CRLF CRLF, NULL);
                 len = strlen(tmp);
--- httpd-2.2.15/modules/http/http_protocol.c.expectnoka
+++ httpd-2.2.15/modules/http/http_protocol.c
@@ -174,6 +174,9 @@ AP_DECLARE(int) ap_set_keepalive(request
      * body should use the HTTP/1.1 chunked transfer-coding.  In English,
      *
      *   IF  we have not marked this connection as errored;
+     *   and the client isn't expecting 100-continue (PR47087 - more
+     *       input here could be the client continuing when we're
+     *       closing the request).
      *   and the response body has a defined length due to the status code
      *       being 304 or 204, the request method being HEAD, already
      *       having defined Content-Length or Transfer-Encoding: chunked, or
@@ -195,6 +198,7 @@ AP_DECLARE(int) ap_set_keepalive(request
      * Note that the condition evaluation order is extremely important.
      */
     if ((r->connection->keepalive != AP_CONN_CLOSE)
+        && !r->expecting_100
         && ((r->status == HTTP_NOT_MODIFIED)
             || (r->status == HTTP_NO_CONTENT)
             || r->header_only
--- httpd-2.2.15/server/protocol.c.expectnoka
+++ httpd-2.2.15/server/protocol.c
@@ -1641,7 +1641,8 @@ AP_DECLARE(void) ap_send_interim_respons
 {
     hdr_ptr x;
     char *status_line = NULL;
-
+    request_rec *rr;
+ 
     if (r->proto_num < 1001) {
         /* don't send interim response to HTTP/1.0 Client */
         return;
@@ -1655,6 +1656,14 @@ AP_DECLARE(void) ap_send_interim_respons
     status_line = apr_pstrcat(r->pool, AP_SERVER_PROTOCOL, " ", r->status_line, CRLF, NULL);
     ap_xlate_proto_to_ascii(status_line, strlen(status_line));
 
+    /* if we send an interim response, we're no longer in a state of
+     * expecting one.  Also, this could feasibly be in a subrequest,
+     * so we need to propagate the fact that we responded.
+     */
+    for (rr = r; rr != NULL; rr = rr->main) {
+        rr->expecting_100 = 0;
+    }
+
     x.f = r->connection->output_filters;
     x.bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
 
