http://qs321.pair.com?node_id=216347

eduardo has asked for the wisdom of the Perl Monks concerning the following question:

Greetings once again!

I am faced with a slight problem, that I don't know how to attack. I need direct access to the client's socket after an HTTP request to an apache server. Let me explain further what I mean:

A client (not a web-browser, a script of some sort), opens up a connection to port 80 on some box where I have apache running, and then it requests a resource. This is part of the problem, as I don't know whether POST, or PUT would be most reasonable (and I can guarantee you that finding examples of PUT handling CGI scripts are *not* easy...) So, it executes a command along the lines of:

POST (or PUT) http://server/cgi-bin/my-script.cgi HTTP/1.1 host: server ???????????????

The fact of the matter is that the ?????'s are being dynamically generated by the client over a potentially long time, so I would like for the server to be in some sort of read loop, handing chunks to the CGI script for partial processing. Just reading from standard in isn't cutting the mustard, nor is doing a multi-part file upload, as it seems like Apache wants to verify the completeness of the entire HTTP request before it passes it off to a handler...

So, oh great knowledgable monks... how do I handle a situation such as this? Is there a way in mod_perl or even normal CGI to get the "data" in some sort of request (POST, PUT, whatever...) before it's been totally completed? And on another note, if anyone has access to a PUT cgi that actually works, I'd be curious to see it...