HTTP (Hyper Text Terminal language)
HTTP is a stateless protocol. It’s used to access data on World Wide Web (www).
HTTP is use TCP port number 80 HTTP works from client request to server and server response to client.
1) The client opens a connection
2) Client send request to server that is http request
3) Server sends response to the client http response
3) Server closes connection.
General scenario as described above is just client is request and server response. Sometimes there is no direct connection between the client and the server and there is one intermediate such as tunnel, proxy server, gateway etc. In this case the client gives request to the gateway or proxy server and pass to another just like a request response chain. One more importing is that the gateway and the proxy server cache the HTTP messages. So if the client requests the message which is already in the gateway or proxy server cache, it’s immediately response to the client so is reduced by network traffic.
HTTP Protocol parameter:
Version: most common version is http 1.1.
The version of http message field is sent like this: "HTTP" "/" "1*Digit". "1*Digit"
URL: It informs the name of the server and location.
A format for request and response are similar.
A request message consist of header, request line, and sometimes body while response message consist of a status line, a header and sometimes body.
Header is useful for exchanging additional information between the client and the server. Client may request to send document in a specific format or the server sends additional information. The header line has a name, space, colon, header value. There are four types of headers:
1) General header: It gives general information about the message and the same request and response. Some general headers are:
Cache control-gives information about caching.
Shows connection status.
Up to date.
Specifies preferred communication protocol.
2) Request header: It is present only in a request message. It gives information about the client configuration and the client’s preferred document format. Examples of request headers are:
Accept - Shows the medium format the client can accept.
From - Shows email address of user.
Host - Show’s host and port number of user.
Referrer - Specifies URL of linked document.
User Agent - Identifies client program.
If-match - Sends a document only it matches a given tag etc.
3) Response header: It is present only in response messages and gives information about the server configuration and the special information about the request.
Accept-range-Shows I the server accepts range requests by client.
Age - Shows document age.
Public – Shows a supported list of documents.
Server - Shows server name and version number.
4) Entity header: It gives information about the body of the document.
Allow - Lists a valid method that can be used with a URL.
E-tag - gives an entity tag.
Expires-provides the date and time when content may change.
Content Encoding - specify encoding scheme.
Request and status line:
The first line in a request message is called a request line and the first line in a response message is called a status line.
It is defined like a method for example:
GET-request a document from a server
HEAD-request a information about a document but not a document itself.
POST-send some information from client to server
PUT-send document from server to client
It’s used in a response message. Codes in 100 ranges are only informational, codes in 200 ranges are successful requests and 300 to redirect a client to another URL and 400 ranges are error at client site.
100 - Continue
101 - Switching
200 - Ok
201 - Created etc
Status phrase: it is used in a response message and explains the status code in text form.
Body: It presents in a request or response message.
HTTP: prior to version 1.1 provides a non-persistent connection, while a persistent connection is the default in version 1.1.