Basics of HTTP & DNS

Basics of HTTP & DNS


5 min read

Basics of HTTP/How the internet and web work

  1. What is DNS:

    • Whenever we type in the website name such as how would our computer know which computer to communicate with in order to show/fetch us the information and get our work done? This thing is managed using DNS (Domain Name System)

    • Work of DNS is to convert into a number (Internet Protocol Address aka IP address).

    • Go to Inspect element in any website -> Networks -> Docs -> -> And see the remote address. This remote address is the conversion of the site into an address using DNS
  2. How does DNS work?

    So basically it contacts with the DNS resolver on your computer. (Either ISP provides it or you have to Manually add it)

    • So what is DNS resolver? : A DNS resolver is a hard coded IP address given to your computer to generate a request like (ip address of

    • Common Primary DNS of computer is

    • This means the computer is going to ask what is ip address of with the help of
    • It takes a question from a client (browser or OS).

      • Client asks the for the IP address of the

      • calls a another DNS(1) and asks him what is the IP address of domains with ".com" are stored. It return a another DNS(2)

      • calls a DNS(2) and asks him for the IP address of Then it returns the another DNS(3).
      • calls a DNS(3) and asks for the IP address of the Then it returns the IP address of the
      • After this it gets connected to the
      • Now may cache the IP address of to save the time in the next call
  3. HTTP

    • There are certain rules to be followed by the client and the server in order to establish a successful communication.

      What is HTTP:

    • It is a plain text protocol.
    • So when you go to the Request headers in the Network -> Doc -> Request headers. What ever you see is the response needed by the client to establish a successful network with the IP address.

      What is Status Code?

    • HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:

      • Informational responses (100โ€“199)
      • Successful responses (200โ€“299)
      • Redirects (300โ€“399)
      • Client errors (400โ€“499)
      • Server errors (500โ€“599) Check more here

      What are port numbers?

    • For example if the computer runs the http and ftp at the same time. How would a server know which service should handle it if the query is comming from the computer. This task is handled by the ports (eg: so 80 si the port here (anything after :)

    • So when you are visiting you are acutally visiting

    • Some comman port numbers
      • http = 80
      • https = 443
    • Each internet protocol is associated with a default port
      • SMTP (25)
      • POP3 (110)
      • IMAP (143)
      • IRC (194) Check more here
    • Whenever you make a request the computer is listening to the post number.
    • It is not mandatory to use as it is predefied but if your have a service running on other port than 443 then you might require to use here 333 is a port defined by us
    • In this way the computer can manage different services cleanly and simultaneously

      What are Request Methods?

    • When we are done with resolving the IP address to the domain name and the port, the next thing it is going to do is sending a request methods.

    • It is the very first thing which is sent when a connection is established between client and a server.

    • GET - It is only used when there is no sending of data from the client to the server (eg : uploading the files, photos)
    • POST - Is used when you want to send the data or interact with the server. eg: (login) Get more here
    • GET and POST are the most important methods. You can pretty much do anything with this methods.
    • POST is superior than any other method because it can function like GET, PATCH, DELETE, PUT etc. because it works on the body.

      What are Request Headers?

    • HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespace before the value is ignored.

    • Headers can be grouped according to their contexts:

      • General headers apply to both requests and responses, but with no relation to the data transmitted in the body.
      • Request headers contain more information about the resource to be fetched, or about the client requesting the resource.
      • Response headers hold additional information about the response, like its location or about the server providing it.
      • Entity headers contain information about the body of the resource, like its content length or MIME type.
    • Headers can also be grouped according to how proxies handle them:

      • Connection
      • Keep-Alive
      • Proxy-Authenticate
      • Proxy-Authorization
      • TE
      • Trailer
      • Transfer-Encoding
      • Upgrade (see also Protocol upgrade mechanism). Check out more infor here
  4. Raw HTTP requests using netcat :

    • Open netcat shell
    • Type in command nc 80 -vvv This will establish the connection to by port 80.
    • Then type `GET / HTTP/ 1.1
    • Then type Host : This is mandatory after 1.1 (if we use GET/ HTTP/ 1 then you can skip it)
    • Then just simply hit enter
    • In this way you can learn to establish the network successfully

Did you find this article valuable?

Support Kaiwalya Koparkar by becoming a sponsor. Any amount is appreciated!