in reply to Re: Can mod_perl get me past a silly buffering in Apache?
in thread Can mod_perl get me past a silly buffering in Apache?

Not so much the whole HTTP protocol. Just the POST request body. I can do that in a CGI, and in fact CGI.pm does just that. ...and I don't really want to parse it, either. I'm just wanting to read it, count it, and pass it on to another program that does the parsing (using CGI.pm, in fact). In case you're wondering, yes it is an upload progress meter, complete with asynchronous Javascript network calls.

I currently have code that, as a CGI, read()s its standard in and gets data that is so many bytes of the request in a loop.

It works this way just fine, and on one server it gets a bit of the request, does its thing, and then gets a little more. On another server, it seems to never run until there's a full request and it reports that the request is done right away the first time that it reports anything. That's the buffering I'm trying to work around -- something in the one server is buffering up the whole request before opening my CGI's stdin and sending the data. Stock Apache 2.0 doesn't seem to do this, and I wasn't aware that stock Apache 1.3 might.

I know there's a record inside mod_perl of the request. I just wanted to know if there's a way to get at it before the whole request is there. If the mod_perl environment doesn't get triggered until the whole request is complete, then it won't be able to do that just like the CGI can't now. If there's no way in mod_perl to address just a part of a request value, then there's no way to do it from mod_perl either.

Thanks for the helpful answer. I'd rather have heard it was easy to do, of course, but informative is the main thing. :-)


Christopher E. Stith
  • Comment on Re^2: Can mod_perl get me past a silly buffering in Apache?

Replies are listed 'Best First'.
Re^3: Can mod_perl get me past a silly buffering in Apache?
by derby (Abbot) on Aug 23, 2006 at 12:14 UTC
Re^3: Can mod_perl get me past a silly buffering in Apache?
by perrin (Chancellor) on Aug 23, 2006 at 15:15 UTC
    As derby pointed out, Apache::UploadMeter does this for mod_perl 1. It patches Apache::Request in order to get C-level access to the internal state of the request in order to do this. I don't know enough about the apache internals to know if there's another way.

    For mod_perl 2, Apache2::UploadProgress does it with an input filter, as I mentioned.

      Thanks, derby and perrin. I'm looking at Apache::UploadMeter now.


      Christopher E. Stith