Introduction to HTTP basics

Communication is the core of human life, without it people will not be able to exchange ideas and interact with each other. There are set of rules followed for proper communication example harmony between listener and speaker. Similar set of rules is followed in world of Internet. In coming paragraphs we will be discussing the basic rule of internet called HTTP (Hyper text transfer protocol). Protocol is set of rules followed for specific purpose.

We will quickly test the above by using a site called that has number of endpoints for testing http requests/responses. We will dive more into this later.

We will be using telnet that is command that allows access to data on websites using  command line.

Steps to test http request:

      1. Open up your terminal
      2. type in telnet 80
      3. type in GET / HTTP/1.1
      4. type in quickly and press ENTER key twice
      5. We will get the html that is located at / (root)

Terminals don’t have layout engine like browsers, so they are not capable of converting html to layout. If we enter we will see the html content in better layout.

Screen Shot 2018-01-11 at 4.41.02 PM









We can access any endpoints available example for viewing xml we can use /xml instead of / in above command.

HTTP Requests:

A basic HTTP request consists of Request line, Headers , Black line and Request Body.

As we know request can be either GET or POST.

we need to pass uri (uniform resource identifier) and HTTP version we are using as seen in below example:

Screen Shot 2018-01-15 at 4.29.12 PM

Headers consist of HOST name, User Agent we are using for sending request and Accepted Language.

Screen Shot 2018-01-15 at 4.32.55 PM.png

Next is a simple blank line and Request body which is applicable only for POST request.

In request body we pass PAYLOAD (data) along with POST request eg we need to pass some data to a particular form we can achieve that by POST request and sending data in Request Body.

Screen Shot 2018-01-15 at 4.33.43 PM.png


HTTP Response’s:

Http Response also has some important parts like:


This consists of Http version, status code and status message. There are lot of status code’s like 200 which means everything is fine, 404 which means resource or page is not available example if we type in and if /blah is not available then we may get 404 error message and then we server error 500 code also. You can get more details on web about all the status code.

Each status code has some message called status message associated with it example 200 has OK message while as 404 has not available message associated.

Screen Shot 2018-01-15 at 4.40.46 PM


Response Headers: 

These usually consist if Server name like nginx or apache, Date on which response was received and Content type. In this case we have content of type xml while we can have html type also.

Screen Shot 2018-01-15 at 4.42.17 PM

Blank Line and Response body:

After a blank line we get actual response in the form of Response Body.

Screen Shot 2018-01-15 at 4.43.03 PM

Note : HTTP Protocol is Stateless. This means it does’nt remember or it does’nt keep the record of previous request. 







Data Structures

What are Linked Lists (Part-1)

I have been asked this question continuously in various technical interviews but I have never been able to give the perfect answer. I will try to jot my understanding of Linked Lists here.

So let us get back to Data Structures. Data Structures are the beautiful and most important topic in the world of Computer science. How to structure your data to save memory and time is what defines a better engineer.  Broadly speaking, they are of two types:

  • Linear Data Structures
  • Non-Linear Data Structures

Linear Data Structures: They can be traversed only sequentially. One of the classic example if of an Array. An array is defined in contiguous memory locations and its memory is fixed. Memory Management is an important aspect of Linear Data Structures. For Adding new data to existing array one needs to copy it and then add the new data. Linked List is also a type of linear data structure.

Non-Linear Data Structures:  They can be traversed in the non sequential way.  Graphs, and Trees are classic examples of this type of data structure.

Let us get started with Linked Lists.

Linked Lists consists of nodes. Starting node is called as HEAD. 

Each node has Two parts. One part consists of Data and other holds the address or memory reference of the next neighboring node. The end of linked list occurs when during traversal a null is encountered.

Linked lists are three types:

  1. Singly Linked Lists: Each node holds the address of only next node.
  2. Doubly Linked Lists: Each node here holds the address of preceding node as well as the node next to it.
  3. Circular Linked Lists: These start and end at the same node called as TAIL.


In next blog, we will dive little deeper into how linked lists manage time and space.