You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Justin Erenkrantz <je...@apache.org> on 2002/06/25 22:21:29 UTC
[PATCH] httpd discards body too soon
On Tue, Jun 25, 2002 at 04:51:06PM -0500, Karl Fogel wrote:
> Justin Erenkrantz <je...@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
Re: [PATCH] httpd discards body too soon
Posted by Cliff Woolley <jw...@virginia.edu>.
On Tue, 25 Jun 2002, Aaron Bannert wrote:
> On Tue, Jun 25, 2002 at 04:25:10PM -0700, Greg Stein wrote:
> > No more magic constants!
>
> Here here! +1
++1
Re: [PATCH] httpd discards body too soon
Posted by Aaron Bannert <aa...@clove.org>.
On Tue, Jun 25, 2002 at 04:25:10PM -0700, Greg Stein wrote:
> No more magic constants!
Here here! +1
-a
Re: [PATCH] httpd discards body too soon
Posted by Greg Stein <gs...@lyra.org>.
On Tue, Jun 25, 2002 at 04:14:00PM -0700, Justin Erenkrantz wrote:
> On Tue, Jun 25, 2002 at 03:55:52PM -0700, Greg Stein wrote:
> > What do you think of the tri-state solution?
> >
> > It *does* mean that we might discard a body, but then later find out we
> > didn't need to. However, it would remove an accidental non-discard.
>
> That'd work. I believe there are some modules that are expecting
> that 0 is closed.
>
> Hmm. Oh, joy:
>
> /** Are we going to keep the connection alive for another request?
> * -1 fatal error, 0 undecided, 1 yes */
> signed int keepalive:2;
>
> Sounds like we just need an explicit no here. Or, we can use the
> -1 to mean 'no.' However, a lot of places are using 0 for no -
> that behavior looks incorrect. -- justin
I say, axe the darned bitfield. That is no 80's. Replace the keepalive flag
with an explicit enumeration.
No more magic constants!
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] httpd discards body too soon
Posted by Greg Stein <gs...@lyra.org>.
On Tue, Jun 25, 2002 at 04:14:00PM -0700, Justin Erenkrantz wrote:
> On Tue, Jun 25, 2002 at 03:55:52PM -0700, Greg Stein wrote:
> > What do you think of the tri-state solution?
> >
> > It *does* mean that we might discard a body, but then later find out we
> > didn't need to. However, it would remove an accidental non-discard.
>
> That'd work. I believe there are some modules that are expecting
> that 0 is closed.
>
> Hmm. Oh, joy:
>
> /** Are we going to keep the connection alive for another request?
> * -1 fatal error, 0 undecided, 1 yes */
> signed int keepalive:2;
>
> Sounds like we just need an explicit no here. Or, we can use the
> -1 to mean 'no.' However, a lot of places are using 0 for no -
> that behavior looks incorrect. -- justin
I say, axe the darned bitfield. That is no 80's. Replace the keepalive flag
with an explicit enumeration.
No more magic constants!
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
Re: [PATCH] httpd discards body too soon
Posted by Justin Erenkrantz <je...@apache.org>.
On Tue, Jun 25, 2002 at 03:55:52PM -0700, Greg Stein wrote:
> What do you think of the tri-state solution?
>
> It *does* mean that we might discard a body, but then later find out we
> didn't need to. However, it would remove an accidental non-discard.
That'd work. I believe there are some modules that are expecting
that 0 is closed.
Hmm. Oh, joy:
/** Are we going to keep the connection alive for another request?
* -1 fatal error, 0 undecided, 1 yes */
signed int keepalive:2;
Sounds like we just need an explicit no here. Or, we can use the
-1 to mean 'no.' However, a lot of places are using 0 for no -
that behavior looks incorrect. -- justin
Re: [PATCH] httpd discards body too soon
Posted by Justin Erenkrantz <je...@apache.org>.
On Tue, Jun 25, 2002 at 03:55:52PM -0700, Greg Stein wrote:
> What do you think of the tri-state solution?
>
> It *does* mean that we might discard a body, but then later find out we
> didn't need to. However, it would remove an accidental non-discard.
That'd work. I believe there are some modules that are expecting
that 0 is closed.
Hmm. Oh, joy:
/** Are we going to keep the connection alive for another request?
* -1 fatal error, 0 undecided, 1 yes */
signed int keepalive:2;
Sounds like we just need an explicit no here. Or, we can use the
-1 to mean 'no.' However, a lot of places are using 0 for no -
that behavior looks incorrect. -- justin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] httpd discards body too soon
Posted by Greg Stein <gs...@lyra.org>.
On Tue, Jun 25, 2002 at 03:21:29PM -0700, Justin Erenkrantz wrote:
>...
> 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).
I'm not sure that "correctly defaults to 0" is truly correct. It seems that
we would want a tri-state value for that variable: unknown, connection-
closes, and connection-stays-open.
This would have solved the problem at hand because the value would have been
"unknown", so the discard would have happened.
>...
> 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
What do you think of the tri-state solution?
It *does* mean that we might discard a body, but then later find out we
didn't need to. However, it would remove an accidental non-discard.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
Re: [PATCH] httpd discards body too soon
Posted by Greg Stein <gs...@lyra.org>.
On Tue, Jun 25, 2002 at 03:21:29PM -0700, Justin Erenkrantz wrote:
>...
> 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).
I'm not sure that "correctly defaults to 0" is truly correct. It seems that
we would want a tri-state value for that variable: unknown, connection-
closes, and connection-stays-open.
This would have solved the problem at hand because the value would have been
"unknown", so the discard would have happened.
>...
> 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
What do you think of the tri-state solution?
It *does* mean that we might discard a body, but then later find out we
didn't need to. However, it would remove an accidental non-discard.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org