Hey, everyone, and welcome back to the Knowledge Portal Video series.
Now, in the earlier lecture, we were discussing the basic about what protocols are all about.
Now, continuing our journey today, we'll be discussing the basics of Http protocol.
So let's go ahead and understand more about it with a simple use cases.
So on the left hand side, you have a client.
Let's assume this as a web browser, a Google Chrome or a Mozilla Firefox.
And on the right hand side you have a web server.
So this web server has certain files within it.
Now, there are three files that you will see over here.
One is movies dot HTML, second is documentary dot mp4, and third is my song dot mp3.
Now this client wants to play documentary dot mp4, which is there within the web server.
So in a very simple terms, how this would really work is the client or a web browser will send a request
to the server asking that I want to watch documentary dot mp4.
Now, depending upon the settings configured in the web server, the web server will reply back saying
that here you go and it will send the documentary dot mp4 file back to the client's web browser.
Now, depending on what kind of player like VLC or HTML5 player, what kind of player a browser has,
it will go ahead and play this documentary MP4, which the server has sent back.
So this is a very simple way of communication between a client and a server.
Http protocol is very similar.
So let's take an example of Http protocol now.
So a web browser will send a request to the web server this time instead of the plain English language
which we had used.
They will be using the Http language.
So what web browser will do?
Web browser will send a request which would be get followed by the name of the file, which is get documentary
dot mp4.
Get basically means that I want to fetch this specific file.
So web server will understand that the client wants to fetch the documentary dot mp4 so the web server
will fetch the documentary MP4 and it will send it back to the client.
Now in the response you see, you have 200.
Okay.
200.
Okay.
Means your request has been successfully processed.
And this is the documentary dot mp4.
Along with that, the web server will also have a header called as content type, which basically tells
what type of content it is, which basically signifies that this specific file is a type video and sub
type is mp4.
So now the web browser will understand that the file which the web server has sent it is of type video
and MP4, and then it will play this specific file according to the player that it has.
So very simple way of communication between a web server and a client.
So let's do one thing.
Let's fire up our Wireshark so this things become much more clear to us.
So let's do one thing.
I have my wireshark up and running, so there are three interfaces over here.
I'm using Wi-Fi, so I'll be selecting the Wi-Fi interface.
So I'll start the capture.
And now let me go ahead and type Dexter Labs dot in.
So this is a very simple page where you have a text information call as let's say, Http and you have
a simple labs dot logo which are designed.
So when you go to the Wireshark now I'll stop the packet capture.
Let's go down.
And this is the get request that was sent.
Let's do one thing.
I'll right click here and I'll select follow the TCP stream.
So.
Let's find it out.
Follow TCP stream.
Perfect.
So now what has happened is this is all internal happenings.
You will not see this in the browser.
So what happened was browser sent this request when we typed Dexter Labs in browser, sent a get request
on the host Dexter Labs.
Now the Web server which is running here, which is running on Dexter's labs and receive the request
and it responded back with 200.
Okay.
200.
Okay.
Basically means the request that my browser made is successfully processed.
And along with that it sent HTML contents back, which you will see you have.
Let's Http and you also have the labs hyphen logo dot PNG.
So this is what actually happened behind the scenes.
Now if you'll see over here, along with the get request, there are a lot of other Http headers which
the browser has sent to the web server.
Now all of these are very important for communication and depending upon the headers which the browser
or a client sends to the web server, the web server will respond according to that.
So this is a very simple way of communication.
So this response that you see over here, you can actually see in the web browser.
So if you right click over here and do a view page source, this is the exact contents that you will
see over here.
So this is the high level overview about the Http protocol.
In the subsequent lectures we will be discussing about each and every headers, which are part of a
routine Http communication so that it will give us a very solid foundation in the Http protocol.
So if you might be wondering how these things are decided and the answer to this is the RFC of Http
protocol.
So RFC basically contains the rules of a Http protocol, and these rules are being followed both by
the client as well as the web server.
And since the rules are followed on both the ends, the communication can proceed.
So we'll be discussing more about all of these in the subsequent lectures.
I hope you understood the basic about the Http protocol in a high level overview and if you have any
doubts, suggestions, questions, feel free to connect us at Twitter, Facebook or LinkedIn or mail
us at instructors at the Rate Labs dot in.
Thanks for watching.