HTTP Requests

by Jeff Hunter, Sr. Database Administrator


HTTP is the protocol that underlies the WWW; the current version of HTTP is 1.0, although 1.1 is already widely deployed, and work is under way to define HTTP-NG. An HTTP request is the message that a Web browser sends to a Web server when it is requesting a document.

A simple get request

A simple get request follows the old HTTP 0.9 specification which, while still in use, is becoming obsolete. Note that the request is followed by two CRLFs.
  GET /document.html[CRLF][CRLF]

A full get request

A full get request follows the HTTP 1.0 specification, and includes the HTTP version number in the request.
  GET /document.html HTTP/1.0[CRLF][CRLF]

A full get request with headers

HTTP/1.0 supports optional headers in a request. The following request tells the server the type of browser being used and requests that the document only be returned if it has been modified more recently than the specified date. This particular header allows the browser to use a cached version of the document if the original has not changed.
  GET /document.html HTTP/1.0[CRLF]
  Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461)[CRLF]
  If-Modified-Since: Fri, 07 Mar 2003 21:23:45 GMT[CRLF][CRLF]

A post request

A post request allows the client to include a significant amount of data in a request. This is used, for example, to submit information to a CGI script or to upload a file to a Web server.
  GET /cgi-bin/guestBookSearch.cgi HTTP/1.0[CRLF]
  Content-Type: <mime-type>[CRLF]
  Content-Length: <length>[CRLF][CRLF]

A head request

A head request requests just the headers of a particular file; this allows the browser, for example, to determine whether a file has been modified and should therefore be downloaded again.
  HEAD /document.html[CRLF][CRLF]

Last modified on: Saturday, 18-Sep-2010 18:04:58 EDT
Page Count: 7201