httpheaders.com
:: overview :: header fields :: header viewer :: articles :: links :: contact :: home :: 
Overview

The Hypertext Transfer Protocol (HTTP) is an application-level protocol used to facilitate the transmission of data to and from a Web server. The protocol defines how a client must ask for data from the server and how the server returns it.

The process of a Web browser or other user agent requesting a document from a server is simple. A typical HTTP request consists of

HTTP-Method Identifier HTTP-version
<Optional additional request headers>

In this example, the HTTP-Method would be GET or POST. An identifier might correspond to the file desired (for example, /index.htm), and the HTTP-version indicates the dialect of HTTP being used, such as HTTP/1.0.

If a user requests a document with the URL http://www.httpheaders.com/index1.htm, the browser might generate a request such as the one shown below to retrieve the object from the server:

GET /index1.htm HTTP/1.0
Host: www.httpheaders.com
Connection: close
User-Agent: Mozilla/5.0 (WinNT)

The request is able to use a relative URL because all the web server needs to do is grab the document from its own file tree. A complete URL is needed when using a proxy server, which requests the document on behalf of the browser.

Below is a table describing the other methods specified in HTTP:

Method Description
GET Returns the object specified by the identifier. Notice that it also is one of the values of the method attribute for the <form> element.
HEAD Returns information about the object specified by the identifier, such as last modification data, but does not return the actual object
OPTIONS Returns information about the capabilities supported by a server if no location is specified, or the possible methods that can be applied to the specified object
POST Sends information to the address indicated by the identifier; generally used to transmit information from a form using the method="POST" attribute of the <form> element to a server-based CGI program
PUT Sends data to the server and writes it to the address specified by the identifier overwriting previous content; in basic form, can be used for file upload
DELETE Removes the file specified by the identifier; generally disallowed
TRACE Provides diagnostic information by allowing the client to see what is being received on the server


Once the web server receives the request it attempts to process it. The result of the request, the status line, is the first line in the response header. The status line has the following format:

HTTP-version HTTP-Status-Code HTTP-Reason-String

For the request example above, the server might send back this response:

HTTP/1.1 200 OK
Server: Apache/1.3.12 (Unix)
Connection: close
Date: Mon, 05 Aug 2002 20:53:32 GMT
Content-Type: text/html
Accept-Ranges: bytes
Last-Modified: Mon, 05 Aug 2002 20:46:41 GMT
ETag: "6ee6f633c13cc21:9aa"
Content-Length: 139

<html>
<head>
<title>httpheaders.com</title>
</head>

<body>
<h1>index1.htm</h1>
<hr>
<p>This is index1.htm</p>

</body>
</html>

The server response will consist of the response headers and also the entity being requested. In the above example, the response headers are from the status line (the first line) to the line containing the Content-Length header. The entity body is from from <html> to </html>.

To learn more about the individual header fields, please visit the header fields page.


[ overview ] [ header fields ] [ header viewer ] [ articles ] [ links ] [ contact ] [ home ]
info@httpheaders.com
© 2002-2009 HTTPheaders.com