As Ryan has pointed out, ap_http_filter doesn't properly
handle 100-Continue requests.  Rather than call
ap_should_client_block, HTTP_IN (aka ap_http_filter) should
handle this transparently (since I am in the camp that
HTTP_IN should handle all HTTP protocol issues).

Untested.  Can I get any concept +1s (or -1s)?  -- justin

Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.407
diff -u -r1.407 http_protocol.c
--- modules/http/http_protocol.c        1 Apr 2002 22:26:09 -0000       1.407
+++ modules/http/http_protocol.c        12 Apr 2002 23:54:34 -0000
@@ -736,6 +736,23 @@
                 return APR_EGENERAL;
             }
         }
+
+        /* Since we're about to read data, send 100-Continue if needed. */
+        if (f->r->expecting_100 && f->r->proto_num >= HTTP_VERSION(1,1)) {
+            char *tmp;
+            apr_bucket_brigade *bb;
+
+            tmp = apr_pstrcat(f->r->pool, AP_SERVER_PROTOCOL, " ",
+                              status_lines[0], CRLF CRLF, NULL);
+            bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
+            e = apr_bucket_pool_create(tmp, strlen(tmp), f->r->pool,
+                                       f->c->bucket_alloc);
+            APR_BRIGADE_INSERT_HEAD(bb, e);
+            e = apr_bucket_flush_create(f->c->bucket_alloc);
+            APR_BRIGADE_INSERT_TAIL(bb, e);
+
+            ap_pass_brigade(f->c->output_filters, bb);
+        }
     }
 
     if (!ctx->remaining) {
@@ -1576,24 +1593,6 @@
 
     if (r->read_length || (!r->read_chunked && (r->remaining <= 0))) {
         return 0;
-    }
-
-    if (r->expecting_100 && r->proto_num >= HTTP_VERSION(1,1)) {
-        conn_rec *c = r->connection;
-        char *tmp;
-        apr_bucket *e;
-        apr_bucket_brigade *bb;
-
-        /* sending 100 Continue interim response */
-        tmp = apr_pstrcat(r->pool, AP_SERVER_PROTOCOL, " ", status_lines[0],
-                          CRLF CRLF, NULL);
-        bb = apr_brigade_create(r->pool, c->bucket_alloc);
-        e = apr_bucket_pool_create(tmp, strlen(tmp), r->pool, c->bucket_alloc);
-        APR_BRIGADE_INSERT_HEAD(bb, e);
-        e = apr_bucket_flush_create(c->bucket_alloc);
-        APR_BRIGADE_INSERT_TAIL(bb, e);
-
-        ap_pass_brigade(r->connection->output_filters, bb);
     }
 
     return 1;

Reply via email to