httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: [PATCH] ap_discard_request_body() can't be called more than once
Date Tue, 04 Jun 2002 00:29:14 GMT
On Sun, Jun 02, 2002 at 04:40:41PM -0700, Justin Erenkrantz wrote:
> This patch combined with the last few patches I've posted today allow
> chunked trailer support again and now passes all httpd-test cases.
> What we try to do is to ensure that ap_discard_request_body() is not
> called before the handler "accepts" the request and begins generating
> the output.  It is still possible for a bad module to call discard
> more than once or improperly.
> This effectively reverts Ryan's patch to http_protocol.c, so
> I'd appreciate it gets some review (preferably from Ryan
> himself!).  -- justin

This is all getting *way* too complicated.

I recall seeing an email where somebody suggested putting a flag in the
request_rec to determine whether HTTP_IN had seen an EOS or not. Bleh. At a
minimum, that would go into the context for HTTP_IN.

I think that the right answer is that when the request_rec is about to go
away, that any unread body content should be read by the framework. It would
be really nice to have filter logic to say "call me when I'm done" so that
HTTP_IN could go ahead and read the rest of the request right then.

If that were done, then you wouldn't have to worry about a bunch of rules
all over the place, about when to call it, to avoid double-calls, etc. In
fact, all of the calls could just go away...

[ note that double-calling ap_discard_request_body() is quite fine. ]

My vote would be to put something into ap_finalize_request_protocol(). (the
problem, of course, is recovering the HTTP_IN context; short of that,
putting the flag into the request_rec or maybe the 'core_request_config'
structure (hmm; the latter would be better).

Note that mod_dav calls it a ton because it generates complete error
responses. It needs to suck up any body, then generate the error, then
return DONE. By returning DONE, we prevent an attempt by ap_die() to
generate messages, but it also means that ap_die() won't discard the body.


Greg Stein,

View raw message