[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] httpd discards body too soon

From: Justin Erenkrantz <jerenkrantz_at_apache.org>
Date: 2002-06-26 00:21:29 CEST

On Tue, Jun 25, 2002 at 04:51:06PM -0500, Karl Fogel wrote:
> Justin Erenkrantz <jerenkrantz@apache.org> writes:
> > Hmph. I'll try to reproduce here, but without the series of SVN
> > commands, this'll be hard. Even if you can send me hard repro
> > recipies, I can probably sort it out.
> >
> > Looks like it's not eating the last line of the previous
> > request. Odd. -- justin
>
> Well, basically I just ran an svn tests over DAV:
>
> $ cd subversion/tests/clients/cmdline
> $ ./basic_tests.py 1 --url http://localhost
>
> after having set up my Apache in the way recommended in the README in
> that directory, of course.

Okay, the problem is that ap_discard_request_body now checks the
keepalive status of the connection (correctly defaults to 0 which
means that ap_discard_request_body never discards requests). That
causes a problem when ap_http_header_filter has not yet run to set
the connection's keepalive state. mod_dav never sent an EOS, so
ap_http_header_filter never executed. So, we must call
ap_discard_request_body only when we know the state of the
connection - which means that we must do so after the EOS is sent
to guarantee that the HTTP header filter ran.

This is a temporary fix, as I think we need to rethink checking the
connection status in ap_discard_request_body since the connection
status is only set once ap_http_header_filter is involved. This
pretty much invalidates calling ap_discard_request_body() anywhere
except once we know the EOS is sent. -- justin

Index: server/protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
retrieving revision 1.106
diff -u -r1.106 protocol.c
--- server/protocol.c 10 Jun 2002 18:51:38 -0000 1.106
+++ server/protocol.c 25 Jun 2002 22:14:28 -0000
@@ -1046,8 +1046,6 @@
  */
 AP_DECLARE(void) ap_finalize_request_protocol(request_rec *r)
 {
- (void) ap_discard_request_body(r);
-
     while (r->next) {
         r = r->next;
     }
@@ -1056,6 +1054,12 @@
     if (!r->eos_sent) {
         end_output_stream(r);
     }
+
+ /* Discard the body after we have ended our output stream.
+ * This allows the ap_http_header_filter to set the keepalive
+ * status of the request.
+ */
+ (void) ap_discard_request_body(r);
 }
 
 /*

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jun 26 00:22:08 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.