INTRODUCTION TO HTTP

Why Stateless?

By being stateless, it means that each request is executed independently without any knowledge of requests that were executed before it. Once the transaction ends then the connection is lost.

Why Application Level Protocol?

The OSI model defines 7 layers as shown below.

  1. Domain Name System — DNS
  2. Simple Mail Transfer Protocol — SMTP
  3. Secure Shell — SSH

Brief History of HTTP

HTTP dates back to 1989 when Tim Barnes Lee was working at CERN. He proposed to build a hypertext system which he named Mesh — turned out to be the World Wide Web.

  1. A textual format to represent hypertext documents — HTML
  2. A client to display and edit the documents — Browser
  3. A server to give access to the document — Web Server
  4. A simple protocol to exchange the documents — HTTP.

HTTP/0.9

It was a single line protocol. Each line started with the only possible method — GET, followed by the path of the resource.

GET /index.html

HTTP/1.0

Versioning info was added to the request line. In the response, a status code was sent. Clients could now recognize a success or a failure.

# Sample Request
GET /mypage.html HTTP/1.0
User-Agent: NCSA_Mosaic/2.0 (Windows 3.1)# Sample Response
200 OK
Date: Tue, 15 Nov 1994 08:12:31 GMTServer: CERN/3.0 libwww/2.17Content-Type: text/html<HTML>A page with an image<IMG SRC="/myimage.gif"></HTML>

HTTP/1.1

This version was launched in 1997. Some of the key features included:

  1. A connection could be reused — in the previous version you had to create a different connection for each request.
  2. Chunked responses were supported — This allowed for messages to be broken into several pieces.
  3. Pipelining was added — Pipelining is the ability to send multiple requests without waiting on the response of a previously sent request.
  4. Cache control mechanisms were added.
  5. Content negotiation was introduced — content negotiation is the mechanism that is used for serving different representations of a resource to the same URI to help the user agent specify which representation is best suited for the user.
  6. The ability to host different domains from the same IP address allowed server collocation — courtesy of the Host Header
# Request
GET /en-US/docs/Glossary/Simple_header HTTP/1.1
Host: developer.mozilla.orgUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: en-US,en;q=0.5Accept-Encoding: gzip, deflate, brReferer: https://developer.mozilla.org/en-US/docs/Glossary/Simple_header# Response
200 OK
Connection: Keep-AliveContent-Encoding: gzipContent-Type: text/html; charset=utf-8Date: Wed, 20 Jul 2016 10:55:30 GMTEtag: "547fa7e369ef56031dd3bff2ace9fc0832eb251a"Keep-Alive: timeout=5, max=1000Last-Modified: Tue, 19 Jul 2016 00:59:33 GMTServer: ApacheTransfer-Encoding: chunkedVary: Cookie, Accept-Encoding

HTTP/2.0

Over the years, web pages have become more complex — more visuals, volume and size of scripts increased. This meant that more complexities with HTTP/1.1

  1. Compressed headers — compressing headers reduces their size in terms of bytes that are transmitted during the connection.
  2. Server push — Allows a HTTP server to send resources to a HTTP client before the client requests them. It loads resources preemptively even before the client realizes it will need them.
  3. Multiplexed protocol — Allows a client to fire off multiple requests at once on the same connection and receive the responses back in any order.
  4. Binary protocol — HTTP messages are formatted into frames and each frame is assigned to a stream. The predecessors were text protocols.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Brian Kitunda

Brian Kitunda

Computer Science student Maseno University, Kenya