Main usage of the HTTP Protocol:
- Hypertext transfer
- Pictures transfer
- Application and server exchange
- Music transfer
- Torrent files exchange
- WebDAV, XML-RPC, SOAP and other protocols realization
- Download updates possible
- Fits for any text-encoded data exchange
Positive and Negative sides of HTTP
HTTP positive sides:
- Widespread up to the present
- 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
- Starting string
- Message body
Here is a protocol’s starting line and header example taken from Google Chrome Webdeveloper Tools:
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:
- OPTIONS, HEAD, PUT, PATCH, TRACE, LINK, UNLINK, CONNECT (additional methods)
The method GET implies a client request for a resource from a server.
It allows incorporating parameters (in red) into the URI:
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.
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.
Headers are of several types and subtypes:
- General headers
- Request Header
- Response header
- Entity headers, having meta data description
- Auxiliary headers
|General Headers||Request Headers||Entity Headers (of request)||Response Headers||Entity Headers (of response)|
Here we post the example of headers for www.papirus.net response:
In the next post we will continue to share on HTTP functionality and features like caching, cookies and others.