Parameters of HTTP

In this section, we will discuss various HTTP parameters and their syntax. For example, date and time format, character set, etc. These parameters are used in the construction of our request and response message while writing the HTTP program of the client or server.

The various parameters of HTTP are as follows:

HTTP Version

To indicate the version of the protocol, HTTP uses a <major>.<minor> numbering scheme. The protocol versioning policy allows the sender to indicate the format of a message and its capacity for understanding further HTTP communication.

The first line in the HTTP-Version field indicates the version of the HTTP message.

Syntax

  1. HTTP-Version   = "HTTP" "/" 1*DIGIT "." 1*DIGIT  

Example

  1. HTTP / 1.1  

Entity Tags

Entity tags are used to compare two or more entities from the same requested resource.

Syntax

  1. entity-tag = [ weak ] opaque-tag  
  2. weak = "W/"  
  3. opaque-tag = quoted-string  

An Entity tag must be unique across all the entity versions associated with a particular resource.

Date/Time Formats

Date/Time format can be defined in two ways:

1) Full Date:

All the date/time stamps of HTTP MUST be represented in Greenwich Mean Time (GMT). HTTP application has three different formats for the representation of date/time stamps:

  1. Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123  
  2. Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036  
  3. Sun Nov  6 08:49:37 1994 ; ANSI C's asctime() format  

In HTTP, GMT is exactly equal to UTC (Coordinated Universal Time), which was indicated in the first two formats by the inclusion of "GMT".

2) Delta Second

Some fields of HTTP header allow a time value, which is specified as an integer number of seconds, which will be in decimal after the time that the message was received.

  1. delta-seconds = 1*DIGIT  

Uniform Resource Identifiers (URI)

URI is simply formatted case insensitive string, which contains the name, location, etc. to identify the website or web server.

Syntax:

  1. http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]  

Here,

  • "http" scheme is used to locate network resources through the HTTP protocol.
  • If the port is empty, the port is assumed to 80. If abs_path is empty, it is equivalent to anabs_pathof "/"Characters in the "unsafe" and "reserved" sets are equivalent to their ""%" HEX HEX"encoding.
  • Comparisons of host names MUST be case-insensitive.

Example:

  1. http://abc.com:80/~smith/home.html  
  2. http://ABC.com/%7Esmith/home.html  
  3. http://ABC.com:/%7esmith/home.html  

Character Set

The Character set is used to specify the character set that the user prefers. Using comma, multiple character sets can be separated. HTTP character sets are identified using the case ?insensitive tokens.

  1. charset = token  

Example

  1. ISO-8859-1  
  2.   
  3. Or   
  4.   
  5. US-ASCII  

Content Codings

Content coding values are used to show an encoding transformation that has been applied to an entity. Primarily, content-codings are used to allow a document to e compressed or transformed without losing the information. In content-coding, an entity is stored in coded form, transmitted directly, and only the recipient it encoded.

  1. content-coding   = token  

All the values of content-coding are case-insensitive. In the Accept-Encoding and Content-Encoding header fields, HTTP/1.1 uses content-coding value.

Example

  1. Accept-encoding: gzip  
  2.   
  3. or  
  4.   
  5. Accept-encoding: compress  

Transfer Codings

The values of transfer coding are used to indicate an encoding transformation that has been applied to an entity to ensure "safe transport" through the network. Transfer coding is different from content coding. Transfer coding is the property of the message, and it is not the original entity.

Syntax:

  1. transfer-coding = "chunked" | transfer-extension  
  2. transfer-extension = token *( ";" parameter )  

In Transfer coding, parameters are in the form of attribute/value pairs.

Example:

  1. Parameter = attribute "=" value  
  2. Attribute = token  
  3. Value = token | quoted-string  

All the values of Transfer coding are case-insensitive.

Product Tokens

Product Tokens allow communication applications to identify themselves by the version and name of the software. Product token should be to the point and short.

Syntax

  1. product = token ["/" product-version]  
  2. product-version = token  

Example

  1. User-Agent: CERN-LineMode/2.15 libwww/2.17b3  
  2. Server: Apache/0.8.4