Saturday, July 12, 2014

Basic of HTTP and Its Methods

What is HTTP?

HTTP (Hypertext Transfer Protocol) is an application-level protocol. Hypertext is structured text that uses logical links (hyperlinks). HTTP is the protocol to transfer hypertext.

What is HTTPS?

Hypertext Transfer Protocol Secured denotes the use of HTTP with SSL (Secure Socket Layer) protocol or its successor protocol Transport Layer Security (TLS). Either of these protocols, which use encryption, can be used to create a secure connection between two machines. SSL uses a cryptographic system that encrypts data with two keys. When a user connects to a website via HTTPS, the website encrypts the session with a Digital Certificate.

How HTTP Works?

HTTP functions as a request-response protocol in the client-server computing model. For example a browser may be the client and an application running on a computer hosting a website may be the server. When a request go from browser -
  1. Parsing the URL and opening a TCP/IP connection.
  2. Sending a request. The request itself comprises 
    • a request line
    • a set of request headers
    • an entity
  3. The server response. The server sends a response that comprises 
    • a status line
    • a set of response headers
    • an entity

HTTP Methods

GET

The GET method is used to retrieve information from the given server using a given URI. Requests using GET should only retrieve data and should have no other effect on the data.

POST

A POST request is used to send data to the server.

HEAD

Same as GET, but only transfer the status line and header section.

PUT

Replace all current representations of the target resource with the uploaded content if that exists. Otherwise it creates new one.

DELETE

Remove all current representations of the target resource given by URI. This method is used to request the server to delete file at a location specified by the given URL.

CONNECT

Establish a tunnel to the server identified by a given URI. It is used by the client to establish a network connection to a web server over HTTP.

OPTIONS

Describe the communication options for the target resource. In detail, it is used by the client to find out what are the HTTP methods and other options supported by a web server.

TRACE

Perform a message loop-back test along the path to the target resource. This method is used to each of the contents of an HTTP Request back to the requester which can be used for debugging purpose at the time of development.

References

Follow this link if you want to know in more details.