HTTP is a client-server text data transfer protocol being used in various applications.
HTTP Classified
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:
- Simplicity
- Scalability
- Widespread up to the present
Negatives:
- Size, because it’s the text format, it isn’t volume optimized
- No encryption
- Openness (vulnerability for being sniffed)
- Stateless protocol (each request is an independent transaction that is unrelated to any previous request)
- Authorization difficulty, the issue of points 3 and 4
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:
- The character encoding (ex. utf-8, cp1252)
- 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
- Starting string
- Headers
- 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:
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
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.