Cryptography Reference
In-Depth Information
Content-Length: 255
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=ISO-8859-1
<html>
<head>
<TITLE>Welcome to the server</TITLE>
</head>
<BODY BGCOLOR=ffffff>
This is the server's homepage
</BODY>
</html>
Here's an example of a 404 “not found” error:
HTTP/1.1 404 Not Found
Date: Tue, 13 Oct 2009 19:40:53 GMT
Server: Apache
Last-Modified: Fri, 27 Oct 2006 01:53:58 GMT
ETag: “1875d-c5-317e9980”
Accept-Ranges: bytes
Content-Length: 197
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=ISO-8859-1
<!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”>
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>
Even though the document requested was not found, a document was returned,
which can be displayed in a browser to remind the user that something has
gone wrong.
For testing purposes, you don't care about the response itself, as long as you
get one. Therefore, don't make any efforts to parse these responses — just dump
their contents, verbatim, on stdout as shown in Listing 1-7.
Listing 1-7: “http.c” display_result
#define BUFFER_SIZE 255
/**
* Receive all data available on a connection and dump it to stdout
*/
void display_result( int connection )
{
int received = 0;
(Continued)
 
Search WWH ::




Custom Search