HTTP stands for HyperText Transfer protocol. Development of HTTP was initiated by Tim Berners-Lee.
It is application layer protocol which provide the communication between HTTPclient 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 toexchange or transfer of Hypertext. HTTP function is a combination of FTP (FileTransfer Protocol) and SMTP (Simple Mail Transfer Protocol). Basically, HTTP isTCP/IP based communication protocol that is used to exchange the data on WorldWide Web. This is foundation of data communication for World Wide Web.Standards development of HTTP was coordinated by Internet Engineering TaskForce (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.Version: Year HTTP Version 1991 0.
9 1996 1.0 1997 1.1 2015 2.0 Working of HTTP:An “HTTP client”is a program that establish a connection and send a request to “HTTP server”.Communication betweenHTTP client and HTTP ServerAn “HTTP server”is also one type of program that accept a request and send response to “HTTPClient”.Features of HTTP:There are some basic feature are describe here.Connectionless: The HTTP client initiates an HTTPrequest, after a request is made it gets disconnected from the server and waitsfor a response.
The server gives the response to the request received and re-establishesthe connection with the client to send a response back.Independent: Any type of data can be sent by HTTPbut 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 candirectly considered as a stateless protocol. The server and client are aware ofeach 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 andthe server cannot gain information of each other during different requestsacross the web pages. HTTP Architecture: Architecture of HTTPprotocol. TheHTTP protocol is based on a request/response model. The communication generallytakes 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 aconnection with a receiving program (a server) and sends a request to the serverin the form of a request method, URI, and protocol version, followed by amessage containing request modifiers, client information, and possible bodycontent. The server responds with a status line, including its protocol versionand a success or error code, followed by a message containing serverinformation, entity met information, and possible body content. HTTP Aspects:MethodsStatus codeRequest/Response LineMessage Handler Methods:There are mainly two basicmethods of HTTP protocol.GET POST 1.GET In GET method onlylimited amount of data can be sent, because data is sent in header.GET method is notsecure in compare to POST method because data exposed in URL bar.GET method is moreefficient and more used than POST method.
GET method can bebookmarked.GET method isidempotent. That means second request will be ignored until the response offirst request will be delivered.GET method send up to1024 character only.GET method can’t besend binary data, audio, video or any type of image file.GET method is basically used forretrieving the information or data from the server using URL.Anatomy of GET Method:Name1=value1=value2=value3In GET method, name andvalue pairs are joined with equal sign and another pair of name and value arejoined with ampersand.
Example: POSTPOST:In POST method largeamount of data can be sent because data can be sent in body part.POST method is moresecure than GET method because data can’t be exposed in URL.POST method is lessefficient and less used than GET method.POST method can’t bebookmarked.POST method isnon-idempotent.
In POST method there isno limit of data size to be sent.In POST method we cansent Binary and ASCII data.POST method basically usedto send data or information on the server.
Example: HEAD: This method is almost similar to GET method but it does not returnthe requested data. It is used to transfer header section, status line, serverresponse 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 typeType of requested Document.
HTTP REQUEST RESPONSE LINE:Request structure ofthe client:message structure:
3) headshould not return message body in the response. Transferstatus line and header section.4) connect: Connection establish between client and server.Example:GET/index.html HTTP/1.1Host :www.
gmail.com2)Request URI:URI stands for uniform resource indentifier.It is used toidentify name and resources on the internet.URI consist 2 parts:1)before the colon( : ) denotes schema(protocol).
2) andthe part after colon depend upon the schema.Eg: http://www.onlinesbi.com3) HTTP version:define the version of http.Eg: HTTP/0.
9 A. Request Header Filed:Therequest-header fields allow the client to pass additional information about therequest, and about the client itself, to the server. These fields act asrequest modifiers. There are of someimportant 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· Referer· TE· User-Agent Example of Request Message:GET /hello.htm HTTP/1.
1 User-Agent: Mozilla/4.0 (compatible;MSIE5.01; Windows NT) Host: www.
example.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive HTTP Response Structure from the Web Server:- message structure: