Attached is a patch that should allow ap_get_brigade() modules to
determine EOS on the same roundtrip as the last read of the request
body contents.
Right now, the caller won't receive an EOS. Coupled with our useless
r->remaining req_rec member, there is no way to determine if there is
no data left to read.
With this patch, pulling a small (say, 200 byte) POST request will
now return the 200 byte bucket, plus the EOS bucket signifying that
we have nothing left to read from the client.
I don't have any immediate proposal on chunked post bodies, but this
should be considered separately any ways.
Bill
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.868
diff -u -r1.868 CHANGES
--- CHANGES 17 Jul 2002 17:55:58 -0000 1.868
+++ CHANGES 17 Jul 2002 18:43:16 -0000
@@ -1,5 +1,10 @@
Changes with Apache 2.0.40
+ *) Modified the HTTP_IN filter to immediately append the EOS (end of
+ stream) bucket for C-L POST bodies, saving a roundtrip and allowing
+ the caller to determine that no content remains without prefetching
+ additional POST body. [William Rowe]
+
*) Get proxy ftp to work over IPv6. [Shoichi Sakane <[EMAIL PROTECTED]>]
*) Look for OpenSSL libraries in /usr/lib64. [Peter Poeml <[EMAIL PROTECTED]>]
Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.448
diff -u -r1.448 http_protocol.c
--- modules/http/http_protocol.c 17 Jul 2002 13:50:26 -0000 1.448
+++ modules/http/http_protocol.c 17 Jul 2002 18:43:22 -0000
@@ -1025,6 +1025,14 @@
ctx->remaining -= totalread;
}
+ /* If we have no more bytes remaining on a C-L request,
+ * save the callter a roundtrip to discover EOS.
+ */
+ if (ctx->state == BODY_LENGTH && ctx->remaining == 0) {
+ e = apr_bucket_eos_create(f->c->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(b, e);
+ }
+
/* We have a limit in effect. */
if (ctx->limit) {
/* FIXME: Note that we might get slightly confused on chunked inputs