HTTP is a client-server text data transfer protocol being used in various applications.

HTTP Classified

Main usage
Pros and contras
Methods
Structure
Resource addressing
Headers
Cookie
Caching
Chunking
HTTP Comet
HTTP tools to work with
HTTPS

Main usage of the HTTP Protocol:

  • Hypertext transfer
  • Pictures transfer
  • Application and server exchange
  • Video
  • Music transfer
  • Torrent files exchange
  • WebDAV, XML-RPC, SOAP and other protocols realization
  • Download updates possible
  • Fits for any text-encoded data exchange

The latest protocol specification is of 1999, HTTP version 1.1.

Positive and Negative sides of HTTP

HTTP positive sides:

  1. Simplicity
  2. Scalability
  3. Widespread up to the present

Negatives:

  1. Size, because it’s the text format, it isn’t volume optimized
  2. No encryption
  3. Openness (vulnerability for being sniffed)
  4. Stateless protocol (each request is an independent transaction that is unrelated to any previous request)
  5. Authorization difficulty, the issue of points 3 and 4
For the HTTP sniffing tools review go to here.

Internet resource addressing

URI – Uniform resource identifier – points to where the web resource is located.

Characters allowed in URI: Latin letters, digits, special characters $-_.+!*'(), reserved characters ;/?:@=&

For non-latin characters there are codings applied in sequence:

  1. The character encoding (ex. utf-8, cp1252)
  2. The hexadecimal character encoding with added ‘%’ sign before it

For example, in charset ‘utf-8’ the plus sign (+) will be encoded as %2B.

HTTP Structure

  1. Starting string
  2. Headers
  3. Message body

Here is a protocol’s starting line and header example taken from Google Chrome Webdeveloper Tools:


HTTP Methods

HTTP methods have the simple semantic:

<method name> <URI> HTTP/<version>

An example of the method ‘GET’ in the starting string:

There are two main and many auxiliary HTTP methods:

  • GET
  • POST
  • OPTIONS, HEAD, PUT, PATCH, TRACE, LINK, UNLINK, CONNECT (additional methods)

GET

The method GET implies a client request for a resource from a server.

It allows incorporating parameters (in red) into the URI:

/wp-admin/post.php?post=4197&action=edit&message=10

The above mentioned GET request parameters are decoded with Google Webmaster Tools:

No other data but those in request string parameters are allowed to transfer with this method. The parameters’ length of the GET method in URI is limited by client and server settings. Most browsers support URIs of up to 2000 characters, while the Apache server supports a default of 8000 characters.

POST

Method POST implies a request to the server with some data appended (not in URI). The following pictures show the method’s starting line, headers and message body:

POST data, here short though:

The Status Codes

The status codes in responses indicate the request status, for example: code 200 – ‘successful HTTP requests’ (see the picture above), code 501 – ‘request not implemented by server’.

The full list of status codes is here.

HTTP Headers

Headers are of several types and subtypes:

  • General headers
  • Request Header
  • Response header
  • Entity headers, having meta data description
  • Auxiliary headers
General HeadersRequest HeadersEntity Headers (of request)Response HeadersEntity Headers (of response)
Cache-ControlAcceptContent-EncodingAccept-RangesAllow
ConnectionAccept-CharsetContent-LanguageAgeContent-Encoding
DateAccept-EncodingContent-LengthAlternatesContent-Language
PragmaAccept-LanguageContent-LocationEtagContent-Length
TrailerAuthorizationContent-RangeLocationContent-Location
Transfer-EncodingExpectContent-TypePublicContent-Range
UpgradeFromContent-VersionRetry-AfterContent-Type
ViaHostDerived-FromServerContent-Version
WarningIf-MatchLinkVaryDerived-From
If-Modified-Since TitleExpires
If-None-MatchLast-Modified
If-RangeLink
If-Unmodified-Since Title
Max-Forwards
Range
Referer
TE
User-Agent

Here we post the example of headers for www.papirus.net response:

One can see the headers either in Google Chrome Webdeveloper Tools or Firebug for FF.
For the full list of HTTP headers and descriptions refer to here.

In the next post we will continue to share on HTTP functionality and features like caching, cookies and others.