Wednesday, 6 April 2016

What is HTTP protocol ?


Hypertext Transfer Protocol (HTTP) 
  • Application Layer protocol for distributed, collaborative, hypermedia information systems
  • Request-response protocol standard for client-server computing
  • Stateless protocol : because each command is executed independently

FUNCTION
  • A web browser acts as a client and application running on a computer hosting the web site acts as a server.
  • The client submits HTTP requests to the responding server by sending messages to it.
  • The server, which stores content (or resources) such as HTML files and images, or generates such content on the fly, sends messages back to the client in response.
  • Resources to be accessed by HTTP are identified using URIs or URLs — using the http or https URI schemes.


HTTP versions
  • HTTP/1.0 uses a separate connection to the same server for every document
  • HTTP/1.1 can reuse the same connection to download, for instance, images for the just served page


HTTP session
  • A sequence of network request-response transactions.
  • HTTP client initiates a request.
  • It establishes a TCP connection to a particular port on a host.
  • HTTP server listening on that port waits for a client's request message. 
  • Upon receiving the request, the server sends back a status line, such as "HTTP/1.1 200 OK", and a message of its own, the body of which is perhaps the requested resource, an error message, or some other information.


HTTPS
  • A URI scheme syntactically identical to the http scheme
  • used for normal HTTP connections, but signals the browser to use an added encryption layer of SSL/TLS to protect the traffic


Example
Client request
GET /index.html HTTP/1.1

Server response
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Etag: "3f80f-1b6-3e1cb03b"
Accept-Ranges: bytes
Content-Length: 438
Connection: close
Content-Type: text/html; charset=UTF-8

No comments:

Post a Comment

Note: only a member of this blog may post a comment.