in reply to Re^2: Decode perl cgi response in C
in thread Decode perl cgi response in C
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.
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
On my computer, entering the command "telnet www.perlmonks.org 80" returns the message "Connecting To www.perlmonks.org...". If I then enter the command "GET / HTTP/1.1" and hit the <Enter> key twice, I get the following:
... 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.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="http://www.w3.org/1999/xhtml" xml:lang="en"> <head>
|
---|
In Section
Seekers of Perl Wisdom