httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Smith" <br...@briansmith.org>
Subject RE: ap_setup_client_block and Content-Length
Date Fri, 15 Feb 2008 17:15:04 GMT
Nick Kew wrote:
> "Charles Fry" <fry@google.com> wrote:
> 
> > Hi,
> > 
> > I desire to access a request's Content-Length from an input filter.
> 
> When it exists, you can get it with
> apr_table_get(r->headers_in, "Content-Length")

There is no way to get an accurate content length if other input filters
have modified the request body's length ahead of yours. For example, try
putting mod_deflate's input filter before yours in the filter chain,
send a "Content-Encoding: deflate" request, and notice that mod_deflate
changed the input length without updating "Content-Length" or anything
else you can use to retrieve how much data you will actually get.

The *only* way to reliably tell how much input is available to your
filter/content-handler is to read all the input until you get to the EOS
bucket or until ap_get_client_block returns 0, counting the bytes along
the way. 

- Brian


Mime
View raw message