HTTP protocol – Status codes – Request and response format – Methods

HTTP protocol

  1. It is application layer protocol used to communicate between client (e.g. web browser) and HTTP server
  2. HTTP protocol follows Client server model

HTTP methods

  1. get
  2. post
  3. head
  4. put
  5. delete
  6. connect
  7. options
  8. trace
  9. patch

Sample request message

  1. A request line (e.g. GET /abc.html HTTP/1.1)
  2. Request header fields (e.g., Cache-Control: no-cache)
  3. An empty line
  4. An optional message body

Sample response message

  1. status line (e.g. HTTP/1.1 200 OK).
  2. Response header fields (e.g. WWW-Authenticate: Basic)
  3. An empty line
  4. An optional message body

HTTP status codes

Status codes can be divided into 5 types as mentioned below

  1. Informational 1XX e.g. 100 continue
  2. Successful 2XX e.g. 200 OK
  3. Redirection 3XX e.g. 301 moved permanently
  4. Client Error 4XX e.g. 404 resource not found, 400 bad request
  5. Server Error 5XX e.g. 500 internal server error

HTTP vs HTTPS

Difference between HTTP and HTTPS is that HTTPS uses certificate and communication is encrypted between client and server.

You may also like...