What is an HTTP?

Developer
What is an HTTP?

The communication protocol used to transport HTML is called HTTP (Hypertext Transfer Protocol) (HTML being the hypertext being transferred). However, it is also used to transmit other files, such as style sheets, photos, and icons, required to display the page. It is not just used to transfer HTML pages. Request messages and response messages are the building blocks of the HTTP protocol. Both the request and the response include optional data content and HTTP headers.

HTTP Request

The headers of the request provide details about the request. These details include the HTTP protocol version to use, the acceptable data types for the browser, the browser being used, and the operating system it is running on. The following gives an illustration of an HTTP request:

GET / HTTP/2
Host: suppatools.com
User-Agent: Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Cookie: .....

HTTP Response

The response is described in an HTTP response header. This includes the HTTP response code that indicates the request's status. Common response codes include :

  • 404 Not Found
  • 200 OK
  • 301 Moved Permanently
  • 302 Moved Temporary

There is a blank line after the header, then any subsequent information. If an HTML page was returned, the HTML data would be in the response's data sections. Below is a sample of an HTTP response that returns an HTML page:

 HTTP/2 200 OK
 server: nginx
 date: Wed, 29 Jun 2022 05:15:38 GMT
 content-type: text/html; charset=UTF-8
 vary: Accept-Encoding
 expires: Thu, 19 Nov 1981 08:52:00 GMT
 cache-control: no-store, no-cache, must-revalidate
 pragma: no-cache
 strict-transport-security: max-age=31536000
 x-content-type-options: nosniff
 x-frame-options: SAMEORIGIN
 x-xss-protection: 1; mode=block
 set-cookie: ....
 x-frame-options: SAMEORIGIN
 x-xss-protection: 1; mode=block
 x-content-type-options: nosniff
 content-encoding: gzip
 X-Firefox-Spdy: h2