comgt
cee oh em gee tee - "commgitt"
Login to access.
User: pw: ?

HTTP
HyperText Transfer Protocol

The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred.

HTTP has been in use by the World-Wide Web global information initiative since 1990. The latest specification defines the protocol referred to as "HTTP/1.1", and is an update to RFC 2068.

Extract from Hypertext Transfer Protocol -- HTTP/1.1 RFC 2616 Fielding, et al.

Below is only short notes of topics of more immediate interest.

Error Codes

( See also Apache 2.1 Custom Error Responses )

Common config of Apache - at least on our development as well as runtime servers (May 2003):

ErrorDocument 400 /404.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html

See the HTTP specification for a complete list of the status codes and their meanings. Extract:

400 Bad Request

The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

401 Unauthorized

The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.47) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity might include relevant diagnostic information. HTTP access authentication is explained in "HTTP Authentication: Basic and Digest Access Authentication" [43].

402 Payment Required (reserved)

403 Forbidden

The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.

404 Not Found

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

(... many other error codes exist in HTTP specification)

Server Error 5xx

Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has erred or is incapable of performing the request. Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. User agents SHOULD display any included entity to the user. These response codes are applicable to any request method.

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

A Mac-encoded text file - uses CR for line breaks
cmdprompt> less printenv.cgi
#!/usr/local/bin/perl -wT^M^Muse strict;^Muse diagnostics;^M^M$|++;^M^Mprint "Co
ntent-Type: text/html\n\n";^Mprint "<HTML><HEAD><TITLE>Printenv Script</TITLE></
HEAD>\n";^Mprint "<BODY>\n";^Mprint map { "<P><B>$_</B> = $ENV{$_}</P>\n" } sort
keys %ENV;^Mprint "</BODY></HTML>\n";
A UNIX (and DOS)-encoded text file - uses LF for line breaks
cmdprompt> less printenv.pl 
#!/usr/local/bin/perl -wT
use strict;
use diagnostics;
$|++;
print "Content-Type: text/html\n\n";
print "<HTML><HEAD><TITLE>Printenv Script</TITLE></HEAD>\n";
print "<BODY>\n";
print map { "<P><B>$_</B> = $ENV{$_}</P>\n" } sort keys %ENV;
print "</BODY></HTML>\n";
[johan@jp2] comgt/search> 	

 

(... many other error codes exist in HTTP specification)