After the connection has been made, the client sends a request for information to the server. For requests, a form of address known as Uniform Resource Identifier (URI) is used. At the moment, URIs are identical to Uniform Resource Locators (URLs) but there is a possibility that Uniform Resource Names (URNs) will be defined in the future, in which case URIs could be either URLs or URNs (CERN 1995).
There are two types of HTTP requests.
A simple request consists of a single line (CERN 1995):
GET URIfollowed by a carriage return/linefeed pair, where the URI is a valid Uniform Resource Identifier as described above.
A full request consists of the following lines (Richmond 1995):
METHOD URI Protocolwhere METHOD is chosen from the list below, URI is a valid Uniform Resource Identifier as described above, and Protocol is a string describing the protocol version in use (e.g. HTTP/1.0)
a message with special instructions for the server, if anyThis message is in MIME format (van Heyn 1995).
There are several methods defined for the full request:
The following is an example of a GET request (Richmond 1995):
GET /cgi-bin/post-query?org=CyberWeb%20SoftWare &users=10000&browsers=lynx&browsers=cello&browsers=mosaic &others=MacMosaic%2C%20WinMosaic &contact=Alan%20Richmond%20Web@Stars.com HTTP/1.0 Accept: www/source Accept: text/html Accept: video/mpeg Accept: image/gif Accept: application/postscript User-Agent: Lynx/2.2 libwww/2.14 From: Web@Stars.com * a blank line *
In this GET, the first line specifies the method and the URL; the next three lines specify contact information; the next five lines specify the types of files that the client can accept, the next two lines identify the client's browser and email address, and then finally a blank line.
The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity as an appendage. That resource may be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request.
POST /cgi-bin/post-query HTTP/1.0 Accept: www/source Accept: text/html Accept: video/mpeg Accept: image/gif Accept: application/postscript User-Agent: Lynx/2.2 libwww/2.14 From: Web@Stars.com Content-type: application/x-www-form-urlencoded Content-length: 150 * a blank line * org=CyberWeb%20SoftWare &users=10000 &browsers=lynx
In this POST, the first line specifies the protocol; the next five lines specify the types of files that the client can accept, the next two lines identify the client's browser and email address, and then finally a description of the content, a statement of content size, a blank line, and the message itself.
The POST method might be used (for example) to post a note to a Usenet newsgroup.