Hyper-Text Transfer Protocol – HTTP 101

What On Earth is HTTP ?

HTTP is a request response protocol that define some sets of rules through which client and server communicate over an already established TCP connection.

Once an TCP connection has been established between client an…


This content originally appeared on DEV Community and was authored by Uzair

What On Earth is HTTP ?

HTTP is a request response protocol that define some sets of rules through which client and server communicate over an already established TCP connection.

Once an TCP connection has been established between client and server, HTTP defines rules for transferring data such as images, text, multimedia etc.

HTTP is not a connection protocol it relies on TCP to establish connection between client and server. Once the server receives HTTP request message sent by client over an opened TCP connection, the server analyses and sends an HTTP response to the client after which TCP connection is closed

And there is no relation or link between two or more HTTP request message sent consecutively over a same TCP connection.

Establishing an HTTP connection ?️

When a client initiates an request-response cycle it performs the following steps:

  • An TCP connection is established
  • Once TCP connection is established the client sends an HTTP request message to the server and server responds to that message
  • TCP connection is closed

HTTP Messages ✉️

There are two types of HTTP message HTTP request msg and HTTP response message

HTTP Request Message

An HTTP request message consist of the following

Fhk3an1Va

  • HTTP Method: These define the nature of request in the above case the method is a GET request
  • Request URI: This identifies the resource upon which HTTP method is to be applied. In the above case its /explore
  • HTTP Version: In the above case its HTTP/1.1
  • HTTP Request Headers: Then Comes the request headers which convey some additional info to the server about the request and client. In the above case we have the following request headers
    1. Host: It contains the IP and Port number of the server where website or resource is stored. In this case its [hashnode.com](http://hashnode.com) and default port number for HTTP is 80 and for HTTPS its 443
    2. Accept-Language: This specifies the language in which client wish to communicate in the above case it en (English)
  • HTTP Request Body: This is an optional feild that contains info being sent for storage, mainly used in POST, PATCH request etc

HTTP Response Message

An HTTP response message consist of the following

1Unf9vpWu

  • HTTP Version: In the above case its HTTP/1.1
  • Status Code: Determines the result of request, in this case its 200
  • HTTP Response Headers: Conveys additional info about the response and server to the client, in this case we are having the following headers
    1. Accept Ranges: It is used by the server to show its support for partial requests
    2. Server: This tells about the nature of server which process the response, In this case its Apache
    3. Content-Type: This indicates the file type of resource, In this case its a html or a txt file
    4. E-Tag: it identifies the specific resource version
  • HTTP Response Body: This is an optional field that contains info sent from server to client mainly in requests like GET request

HTTP Methods:

  • GET - This method retrieves the resource specified in the request-URI. If successful the resource is returned as an entity in the response message along with the status code 200 (Success).
  • POST - This method is used to modify data in server if successful the server responds by sending a response message containing the status code 201 (Created), along with the location of the posted entity or data.
  • PUT - Update data in server
  • DELETE - Delete data in server

HTTP Status Codes:

Common-HTTP-error-Blog-Post-Image
httpStatusCode_de_en

Read More Over here:

HTTP: Hypertext Transfer Protocol (article) | Khan Academy


This content originally appeared on DEV Community and was authored by Uzair


Print Share Comment Cite Upload Translate Updates
APA

Uzair | Sciencx (2021-09-15T15:18:31+00:00) Hyper-Text Transfer Protocol – HTTP 101. Retrieved from https://www.scien.cx/2021/09/15/hyper-text-transferprotocol-http-101/

MLA
" » Hyper-Text Transfer Protocol – HTTP 101." Uzair | Sciencx - Wednesday September 15, 2021, https://www.scien.cx/2021/09/15/hyper-text-transferprotocol-http-101/
HARVARD
Uzair | Sciencx Wednesday September 15, 2021 » Hyper-Text Transfer Protocol – HTTP 101., viewed ,<https://www.scien.cx/2021/09/15/hyper-text-transferprotocol-http-101/>
VANCOUVER
Uzair | Sciencx - » Hyper-Text Transfer Protocol – HTTP 101. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/09/15/hyper-text-transferprotocol-http-101/
CHICAGO
" » Hyper-Text Transfer Protocol – HTTP 101." Uzair | Sciencx - Accessed . https://www.scien.cx/2021/09/15/hyper-text-transferprotocol-http-101/
IEEE
" » Hyper-Text Transfer Protocol – HTTP 101." Uzair | Sciencx [Online]. Available: https://www.scien.cx/2021/09/15/hyper-text-transferprotocol-http-101/. [Accessed: ]
rf:citation
» Hyper-Text Transfer Protocol – HTTP 101 | Uzair | Sciencx | https://www.scien.cx/2021/09/15/hyper-text-transferprotocol-http-101/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.