> > Yes, this code works and I am using it, too. But the > documentation says, > > you can use > > $r->read($buf, $r->headers_in->{'content-length'} > > this statement reads the entire request content in one iteration by > using a read buffer size equal to the content-length of the request. > > > http://perl.apache.org/docs/2.0/user/porting/compat.html > > I want to know if the documentation is wrong, and if it is wrong, it > > should be corrected! > > I'm not sure if there is anything wrong with it, seems like a > good way > to slurp the request content. > > If the request content is large and you are performing a memory > intensive operation on each chunk then you might want to read > in a while > loop as in your first example and perform some work on each chunk, so > that the overall memory usage is low. > Please read my initial posting:
... But there are two problems with $r->read($buf, $r->headers_in->{'content-length'} 1. An input filter can change the length of the incoming content. It can be longer than before, but the content-length header will not be changed, so some data will be missing. 2. If the POST data are sent per chunked encoding, there is no content-length header at all. Peter