DEV Community

Cover image for HTTP
NIKHIL GAUTAM
NIKHIL GAUTAM

Posted on • Edited on

HTTP

WHAT IS HTTP ?

  • Hyper Text Transfer Protocol
  • Communication between web servers & clients
  • HTTP Request/Responses
  • Loading pages, form submit, Ajax calls

HTTP IS STATELESS

  • Every request is completely independent
  • Similar to transactions
  • Programming,Local Storages,Cookies,Sessions are used to create enchanced user experiences.

WHAT IS HTTPS?

  • Hyper Text Transfer Protocol Secure
  • Data sent is encrypted
  • SSL/TLS
  • Install certificate on web host

Protocol means "set of rules"

SSL : SSL Stands for Secure Sockets Layer.
TLS : TLS Stands for Transport Layer Security.

SSL is a protocol used to send information securely through the network. Websites use SSL to secure user account pages and for online checkouts. It encrypts the data to avoid a third party accessing the transmitting data. On the other hand, TLS protocol is a successor to SSL. It provides privacy, integrity, and protection to the data. It allows communication across the network without interference by eavesdropping and tampering. In brief, the TLS is more secure and efficient than the SSL.

HTTP METHODS

when a request is made to a server it has some kind of methods attached to it.

  • GET - Retrives data from the server.
  • POST - Submit data to the server.
  • PUT - Update data already on the server.
  • DELETE - Delete data from the server.

HTTP HEADER FIELDS

1.General: Request URL , Request Method , status code , Remote Address,Referrer Policy.

2.Response: Server,Set Cookies ,Content-Type,Content-Length,Date.

3.Request: Cookies,Accept-XXX,Content-Type,Authorization,User Agent ,Referrer.

General:
1.Request URL - contains the URL request you are requesting.
2.Request Method - GET,POST,PUT & DELETE request
3.Status Code -
4.Remote Address - Ip of the remote computer.
5.Referrer Policy - if you go from one page to another page

Response:
1.Server - The Server header describes the software used by the origin server that handled the request — that is, the server that generated the response.

  1. Set-Cookies- used for servers to send small pieces of data called cookies from the server to the client
  2. Content-Type- Every response has a content type If it's HTML = text/html , CSS = text/css, Images = image/png,image/jpeg ,JSON= Application/JSON 4.Content Length - octets 8-bit bytes . 5.Date

Request:

  1. Cookies
  2. Accept -xxx 3.Content-Type 4.Content-Length 5.Authorization 6.User-Agent 7.Referrer

HTTP STATUS CODES

  1. Informational responses (100–199)
  2. Successful responses (200–299)
  3. Redirection messages (300–399)
  4. Client error responses (400–499)
  5. Server error responses (500–599)

Some Commonly Used Status Codes are:

200- OK
201 -Ok created
301-Moved to new URL
304-Not modified (Cached version)
400-Bad request
401-Unauthorized
404- Not found
500-Internal server error

HTTP/2

  • Major revision of HTTP
  • Under the hood changes
  • Respond with more data
  • Reduce latency by enabling full request and response multiplexing.
  • Fast,efficient & secure.

Top comments (0)