httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: ap_discard_request_body() problems
Date Fri, 19 Nov 1999 00:49:07 GMT
Oh... never mind. I found how it protects against a double-call.
ap_get_client_block() increments r->read_length. discard() checks to
ensure that is zero before doing anything. i.e. if a handle starts reading
any portion of the body, then it better read the whole thing.


On Thu, 18 Nov 1999, Greg Stein wrote:

> It seems that ap_discard_request_body() could really bung things up if it
> happens to be called twice. Each time it is called, it resets how much
> data needs to be read from the client. Then it proceeds to read that
> amount.
> Okay, fine: make sure to call it only once.
> Well... that is quite difficult. The comments in the source encourage
> placing it at the top of your handler if you don't have a body. However,
> if you return something other than DONE from your handle (e.g.
> HTTP_NOT_FOUND), then ap_die() will *also* call it.
> Oh, ick. Just thought of a related problem. Let's say that I consume the
> request body, parse it, and return an error. Oops.
> ap_discard_request_body() will get called and tried to read that input
> again.
> I think the proper resolution is to allow ap_discard_request_body() to do
> nothing if all input has been read. However, I'm not clear on what
> variables in the request record are used to determine "okay, we've got it
> all."
> Thoughts?
> thx,
> -g
> -- 
> Greg Stein,

Greg Stein,

View raw message