HTTP stands for Hyper Text Transfer protocol. Development of HTTP was initiated by Tim Berners-Lee. It is application layer protocol which provide the communication between HTTP client and HTTP server. HTTP protocol mainly used to access data on World Wide Web (WWW).
HTTP protocol use the services of TCP on port 80. HTTP is a protocol to exchange or transfer of Hypertext. HTTP function is a combination of FTP (File Transfer Protocol) and SMTP (Simple Mail Transfer Protocol). Basically, HTTP is TCP/IP based communication protocol that is used to exchange the data on World Wide Web. This is foundation of data communication for World Wide Web. Standards development of HTTP was coordinated by Internet Engineering Task Force (IETF).
First version of HTTP was developed in 1991 which is HTTP/0.9. Main function of HTTP is to transmit data across the internet.VERSIONYearHTTP Version19910.919961.019971.
120152.0Working of HTTP:? An “HTTP client” is a program that establish a connection and send a request to “HTTP server”.Communication between HTTP client and HTTP Server? An “HTTP server” is also one type of program that accept a request and send response to “HTTP Client”.FEATURES OF HTTP PROTOCOL:There are some basic feature are describe here.
? Connectionless: The HTTP client initiates an HTTP request, after a request is made it gets disconnected from the server and waits for a response. The server gives the response to the request received and re-establishes the connection with the client to send a response back.? Independent: Any type of data can be sent by HTTP but both the client and the server should know how to handle the data content. It is required by both to specify the content type using appropriate MIME-type.? Stateless: As HTTP is connectionless it can directly considered as a stateless protocol. The server and client are aware of each other only while they are doing transaction with each other. After that, both of them has no knowledge about each other.
Due to this, both client and the server cannot gain information of each other during different requests across the web pages.HTTP Aspects:MethodsStatus codeRequest/Response LineMessage HandlerHTTP Architecture:The HTTP protocol is based on a request/response model. The communication generally takes place over a TCP/IP connection on the Internet. The default port is 80, but other ports can be used.
A requesting program (a client) establishes a connection with a receiving program (a server) and sends a request to the server in the form of a request method, URI, and protocol version, followed by a message containing request modifiers, client information, and possible body content. The server responds with a status line, including its protocol version and a success or error code, followed by a message containing server information, entity met information, and possible body content.Methods:There are mainly two basic methods of HTTP protocol.1. GET2.
POST3. HEAD4. PUT5. DELETE6. CONNECT7.
OPTION8. TRACEA. GET? In GET method only limited amount of data can be sent, because data is sent in header .GET method is not secure in compare to POST method because data exposed in URL bar.
GET method is more efficient and more used than POST method. GET method can be bookmarked. GET method is idempotent. That means second request will be ignored until the response of first request will be delivered. GET method send up to 1024 character only.
GET method can’t be send binary data, audio, video or any type of image file.? GET method is basically used for retrieving the information or data from the server using URL.Anatomy of GET Method:Name1=value1=value2=value3In GET method, name and value pairs are joined with equal sign and another pair of name and value are joined with ampersand.Example:B. POST:? In POST method large amount of data can be sent because data can be sent in body part. POST method is more secure than GET method because data can’t be exposed in URL.
POST method is less efficient and less used than GET method. POST method can’t be bookmarked. POST method is non-idempotent.
In POST method there is no limit of data size to be sent. In POST method we can sent Binary and ASCII data. POST method basically used to send data or information on the server.Example:C. HEADThis method is almost similar to GET method but it does not return the requested data. It is used to transfer header section, status line, server response code etc.
HEAD is often used to check the following information:? Last-modified date of a document on the server for caching purpose.? Size of a document before downloading.? Server type? Type of requested DocumentExample:D. PUT:The PUT method is used to request the server to store the included entity-body at a location specified by the given URL.
PUT method replace all the current representation of the target resource with the uploaded content.E. DELETE:The DELETE method is used to request the server to delete a file at a location specified by the given URL.DELETE method delete the addressed member of the collection.F. CONNECTThe CONNECT method is used by the client to establish a network connection to a web server over HTTP.
G. OPTION:The OPTIONS method is used by the client to find out the HTTP methods and other options supported by a web server. The client can specify a URL for the OPTIONS method, or an asterisk (*) to refer to the entire server.H.
TRACE:The TRACE method is used to echo the contents of an HTTP Request back to the requester which can be used for debugging purpose at the time of development.HTTP REQUEST/RESPONSE LINE:A. Request Structure of the Client:Message Structure:
Request Method2. Request URI3. HTTP versionRequest Method:1 .
GET: GET method is used for retrieving the info. or data from the server using URL.2. POST: POST method is used to send data or Information to the server.3.
HEAD: Transfer status line and header section.4) CONNECT: Connection establish between client and server.Example:GET/index.
html HTTP/1.1Host: www.gmail.comRequest URI:URI stands for uniform resource identifier. It is used to identify name and resources on the internet.
URI consist 2 parts:1. Before the colon( : ) denotes schema(protocol).2. And the part after colon depend upon the schema.Example:http://www.onlinesbi.comHTTP version:HTTP version define the version of http.
Example:HTTP/0.9Request Header Filed: The request-header fields allow the client to pass additional information about the request, and about the client itself, to the server. These fields act as request modifiers.There are of some important Request-header fields:? Accept-Charset? Accept-Encoding? Accept-Language? Authorization? Expect? From? Host? If-Match? If-Modified-Since? If-None-Match? If-Range? If-Unmodified-Since? Max-Forwards? Proxy-Authorization? Range? Referrer? TE? User-AgentExample of Request Message:GET /hello.htm HTTP/1.
1User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)Host: www.example.comAccept-Language: en-usAccept-Encoding: gzip, deflateConnection: Keep-AliveB. HTTP Response Structure from the Web Server:Message Structure: