Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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...

In reply to Direct access to client socket in CGI/mod_perl? by eduardo

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (4)
    As of 2020-08-09 21:36 GMT
    Find Nodes?
      Voting Booth?
      Which rocket would you take to Mars?

      Results (55 votes). Check out past polls.