Pr.Pg Next Pg

Client HTTP Request tutorials

  • When a Client browser requests for a web page, it sends lot of information to the web server which cannot be read directly because this information travel as a part of header of HTTP request.

  • HTTP header fields are components of the message header of requests and responses in the Hypertext Transfer Protocol (HTTP). They define the operating parameters of an HTTP transaction.

  • The header fields are transmitted after the request or response line, the first line of a message.

  • Following is the important header information which comes from browser side and you would use very frequently in web programming:

 

Header

Description

Example

Accept

This header specifies the MIME types that the browser or other clients can handle. Values of image/png or image/jpeg are the two most common possibilities.

Accept: text/plain

Accept-Charset

This header specifies the character sets the browser can use to display the information. For example ISO-8859-1.

Accept-Charset: utf-8

Accept-Encoding

This header specifies the types of encodings that the browser knows how to handle. Values of gzip or compress are the two most common possibilities.

Accept-Encoding: gzip, deflate

Accept-Language

This header specifies the client's preferred languages in case the servlet can produce results in more than one language. For example en, en-us, ru, etc.

Accept-Language: en-US

Authorization

This header is used by clients to identify themselves when accessing password-protected Web pages.

Authorization:Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Connection

This header indicates whether the client can handle persistent HTTP connections. Persistent connections permit the client or other browser to retrieve multiple files with a single request. A value ofKeep-Alive means that persistent connections should be used

Connection: keep-alivep>

Content-Length

This header is applicable only to POST requests and gives the size of the POST data in bytes.

Content-Length: 348

Cookie

This header returns cookies to servers that previously sent them to the browser.

Cookie: $Version=1; Skin=new;

Host

This header specifies the host and port as given in the original URL.

Host: en.samedu.in:80

Host: en.samedu.in

If-Modified-Since

This header indicates that the client wants the page only if it has been changed after the specified date. The server sends a code, 304 which means Not Modified header if no newer result is available.

If-Modified-Since: Sat, 29 Oct 2008 19:43:31 GMT

If-Unmodified-Since

This header is the reverse of If-Modified-Since; it specifies that the operation should succeed only if the document is older than the specified date.

If-Unmodified-Since: Sat, 29 Oct 2008 19:43:31 GMT

Referer

This header indicates the URL of the referring Web page. For example, if you are at Web page 1 and click on a link to Web page 2, the URL of Web page 1 is included in the Referer header when the browser requests Web page 2.

Referer: http://en.samedu.in/index_page

User-Agent

This header identifies the browser or other client making the request and can be used to return different content to different types of browsers.

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0

Pr.Pg border                                              Next Pg