Hyper Text Transfer Protocol

What is HTTP ?

HTTP is what’s used whenever you view a website, developed by Tim Berners-Lee and his team between 1989-1991. HTTP is the set of rules used for communicating with web servers for the transmitting of webpage data, whether that…


This content originally appeared on DEV Community and was authored by Rajat Agrawal

What is HTTP ?

HTTP is what's used whenever you view a website, developed by Tim Berners-Lee and his team between 1989-1991. HTTP is the set of rules used for communicating with web servers for the transmitting of webpage data, whether that is HTML, Images, Videos, etc.

What is HTTPS ?

HTTPS is the secure version of HTTP. HTTPS data is encrypted so it not only stops people from seeing the data you are receiving and sending, but it also gives you assurances that you're talking to the correct web server and not something impersonating it.

When we access a website, your browser will need to make requests to a web server for assets such as HTML, Images, and download the responses. Before that, you need to tell the browser specifically how and where to access these resources, this is where URLs will help.

What is a URL ?

A URL is predominantly an instruction on how to access a resource on the internet. The below image shows what a URL looks like with all of its features -

Image description

  • Protocol: This instructs on what protocol to use for accessing the resource such as HTTP, HTTPS, FTP (File Transfer Protocol).
  • Domain: The domain name or IP address of the server you wish to access.
  • Port: The Port that you are going to connect to, usually 80 for HTTP and 443 for HTTPS, but this can be hosted on any port between 1 - 65535.
  • Path: The file name or location of the resource you are trying to access.
  • Query string: Extra bits of information that can be sent to the requested path. For example, /blog?search=test would tell the blog path that you wish to receive the blog articles with search parameter value as test.
  • Fragment: This is a reference to a location on the actual page requested. This is commonly used for pages with long content and can have a certain part of the page directly linked to it, so it is viewable to the user as soon as they access the page.

How to make a request ?

Image description

It is possible to make a request to a web server with just one line GET / HTTP/1.1. But for a much richer web experience, you’ll need to send other data as well. This other data is sent in what is called headers, where headers contain extra information to give to the web server you’re communicating with, but we’ll go more into this in the Header task.

Example Request :


GET / HTTP/1.1
Host: www.google.ie
User-Agent: Mozilla/5.0 Firefox/87.0
Referer: https://www.google.com/

To breakdown each line of this request:

  • Line 1: This request is sending the GET method ( more on this in the HTTP Methods task ), request the home page with / and telling the web server we are using HTTP protocol version 1.1.
  • Line 2: We tell the web server we want the website google.ie
  • Line 3: We tell the web server we are using the Firefox version 87 Browser
  • Line 4: We are telling the web server that the web page that referred us to this one is https://www.google.com
  • Line 5: HTTP requests always end with a blank line to inform the web server that the request has finished.

Example Response :


HTTP/1.1 200 OK
Server: nginx/1.15.8
Date: Sat, 03 Jun 2023 10:00:00 GMT
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 98

<html>
<head>
    <title>Google</title>
</head>
<body>
    Welcome To Google.com
</body>
</html>

More about HTTP headers, HTTP methods and HTTP response codes in the upcoming blog.


This content originally appeared on DEV Community and was authored by Rajat Agrawal


Print Share Comment Cite Upload Translate Updates
APA

Rajat Agrawal | Sciencx (2023-06-03T03:55:37+00:00) Hyper Text Transfer Protocol. Retrieved from https://www.scien.cx/2023/06/03/hyper-text-transfer-protocol/

MLA
" » Hyper Text Transfer Protocol." Rajat Agrawal | Sciencx - Saturday June 3, 2023, https://www.scien.cx/2023/06/03/hyper-text-transfer-protocol/
HARVARD
Rajat Agrawal | Sciencx Saturday June 3, 2023 » Hyper Text Transfer Protocol., viewed ,<https://www.scien.cx/2023/06/03/hyper-text-transfer-protocol/>
VANCOUVER
Rajat Agrawal | Sciencx - » Hyper Text Transfer Protocol. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/06/03/hyper-text-transfer-protocol/
CHICAGO
" » Hyper Text Transfer Protocol." Rajat Agrawal | Sciencx - Accessed . https://www.scien.cx/2023/06/03/hyper-text-transfer-protocol/
IEEE
" » Hyper Text Transfer Protocol." Rajat Agrawal | Sciencx [Online]. Available: https://www.scien.cx/2023/06/03/hyper-text-transfer-protocol/. [Accessed: ]
rf:citation
» Hyper Text Transfer Protocol | Rajat Agrawal | Sciencx | https://www.scien.cx/2023/06/03/hyper-text-transfer-protocol/ |

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.