Welcome back if you are my returning reader. Thank you for the support of your presence.
If this is your first time here, welcome, and thank you for coming.
Before moving forward, I want to clarify something by answering this question I received from one of my readers:
where do I find my articles? Is it from random internet searches?
In fact, throughout my learning life, I have learned a lot. These articles are not just random research results, but what I have learned along the way from my studies. An experience that I wanted to share it with others.
Recall from our previous publications, we learned how the internet works and how computers are interconnected. We have also learned that the Internet is based on protocols and that for any technology to use the Internet it must be based on these protocols.
IP, TCP, HTTP are a few examples of some of those protocols that constitute the universe of the internet.
The web is a great service that helps us to get, send, and manipulates data from point A to B. It uses some functionalities to make it possible.
To use the web, we use a web browser to navigate the internet.
We have some major web browsers such as:
- Internet explorer
- Opera (Opera-mini)
In the browser, on the top field, we usually type the URL like this:
http://example.com or https://example.com
At the moment you press the send or press the enter key, you are sending a request from your devices such as phone, laptop, or tablet, called client-side to a remote server. And that server purpose in life is to look at your request and respond to it with the response desired.
When you type in example.com for instance and submit, many things happen under the hood.
First of all, your browser needs to know the IP address of that domain name you just typed in. If it does not know, it is going to ask for it from the nearest DNS, say: I want to go to example.com but I do not know the address, then the nearest DNS is going to ask among them for the address, then when the IP address is found, the DNS answer back to your browser with that corresponding IP address. Read more on DNS, and IP in my previous publication What is an IP address and DNS.
After receiving that, your browser is going to format your request and send them to that address, who is the IP address of that website. Then you will get your result displays.
Let’s say you are just asking for a photo of a cat. When you run your request, it turns out that your request is formatted and packaged in an envelope before sending it to the server. And in that envelope will be the IP address of the server that got the image of the cat, in the body part.
In the head, here is how the request for a photo of a cat can be:
GET /cat.jpg HTTP / 2.0
It just mean, get a picture of a cat using HTTP language version 2.0
What is in the envelope that comes back?
In the envelope that comes back from the server, the response is formatted in one, two, or more packets if everything is well-formatted. Read more on How data is delivered reliably on the internet to understand why data is formatted to multiple packets.
The response that comes back from the server is formatted in a language called HTTP or Hypertext Protocol. It is the mechanism that handles communications, how a computer can speak to another.
Every request and response that uses HTTP is composed of 2 major parts:
- HTTP header and
- HTTP body.
Then here is the response from the server
HTTP/2.0 200 OK
Just mean your request has been received and found what you asked for.
This communication part is not known by the user, but by the browser user uses. The browser can interpret that header response to decide if it can display it to the user according to the code and protocol implementations.
And those codes are called Static HTTP Header codes.
The essential codes are:
- 200 OK
- 301 Moved Permanently
- 302 Found
- 304 Not Modified
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
- 500 Internal Server Error
- 200 OK: when your request was successful and found what you requested. This code does not show to the user. It just tells the browser to show or display all body content without hiding anything.
- 301 and 302: This code indicates that your browser should redirect you to another URL, different from the previous.
- 304 Not Modified: This code is when the server wants to save time, and bandwidth or something similar, that means, hey browser, you already asked me for that data a few moments ago and it has not been modified yet, I’m not going to waste my time to send you it again, you must check your cache. Then by receiving this code from the server, the browser is going to display data from his cache to the user. This happens so fast that you will not know it happened.
The cache is part of memory in the browser that keeps a copy of all our navigations or site visited. Tip: When you use a public computer from a library, or internet café to surf the internet, you need to clear your browser history and your cache to avoid a malicious person to know which site you have been on and may compromise your data save on cache memory.
- 401 Unauthorized and 403 Forbidden: When you are not allowed to access that site may be due to certain authentication, the server is going to respond with one of those codes.
- 404 Not Found: This is the popular one, that most of us know. And I am sure that everyone that uses to surf the internet has already come across this code of 404. This code always displays the browser. It is the standard code that means when the server can not found what the user is looking for, it returns this code to the browser, then the browser will decide to display the code to the browser.
- 500 Internal Server Error: This is the worst of HTTP error codes. When you see this code display in the browser, it does not have anything to do with you, neither with the server. It is to do with the programmer that implemented the website. The server could not be able to display the website or to read the content. So this is to the programmer to reimplement or fix the issue.
Then what else is in the envelope that came from the server for instance with code 200 OK or beside de HTTP numeric codes?
We will see it in Web development part 2 that we will talk about in the next publication.
Thanks for reading.