Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I get the feeling that you want help on the HTTP protocol. If you don't have (or can't use) any libraries to help, a minimal method would be to open a TCP connection and send a request message, which consists of the following:
  • A request line, for example GET /images/logo.png HTTP/1.1, which requests a resource called /images/logo.png from the server.
  • Request Headers, such as Accept-Language: en
  • An empty line.
  • An optional message body.
The request line and headers must all end with <CR><LF> (that is, a carriage return character followed by a line feed character). The empty line must consist of only <CR><LF> and no other whitespace. In the HTTP/1.1 protocol, all headers except Host are optional (but in practice, it's also optional if there's only one name associated with the IP address). A request line containing only the path name is accepted by servers to maintain compatibility with HTTP clients before the HTTP/1.0 specification.

You will then be able to read the response message, which consists of the following:

  • A Status-Line (for example HTTP/1.1 200 OK, which indicates that the client's request succeeded)
  • Zero of more Response Headers, such as Content-Type
  • An empty line
  • An optional message body
The Status-Line and headers must all end with <CR><LF> (a carriage return followed by a line feed). The empty line must consist of only <CR><LF> and no other whitespace.

On my computer, entering the command "telnet 80" returns the message "Connecting To". If I then enter the command "GET / HTTP/1.1" and hit the <Enter> key twice, I get the following:

HTTP/1.1 200 OK Via: 1.1 ETC-USRPXY-02 Connection: Keep-Alive Proxy-Connection: Keep-Alive Content-Length: 47589 Date: Wed, 24 Jul 2013 14:08:33 GMT Age: 74 Content-Type: text/html ETag: "b9e5-4e24268fd6b00" Server: Apache/2.2.24 Accept-Ranges: bytes Last-Modified: Wed, 24 Jul 2013 14:06:04 GMT <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html xmlns="" xml:lang="en"> <head>
... followed by roughly 47 KB of other data. You can experiment by using telnet to connect to your server and see what you get back.

In reply to Re^3: Decode perl cgi response in C by samwyse
in thread Decode perl cgi response in C by stenasc

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 all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (7)
    As of 2018-04-19 20:20 GMT
    Find Nodes?
      Voting Booth?