Let’s talk about H. T. T. P. I’m sure a lot of you have heard about this way before.
Hypertext Transfer Protocol is the backbone of the internet. I want to make this content first because actually understanding H. T. T. P. N.
Just the basics of how works are really the prerequisites and like the foundation to understand a lot of more complicated internet and web things like in https //aka.ms/remoteconnect.
All right so this content I wrote down 6 imported just basic points about this protocol HTTP we’re gonna talk through all 6 points run through them and hope it’s useful all right guys.
H.T.T.P Follows Client-Server Model
Let’s do it first point most basic point is that H. T. T. P. follows the standard client-server model or request-response model. So I often use kitchens, I always use kitchens as my analogy because I don’t know if it’s really convenient. We’ve talked about this before basic client-server model.
You are a person going to eat in a kitchen with your client and the kitchen is responding to your request. So you go in I want a big mac the kitchen goes all right here’s a big mac.
So the web browser you’re using right now to watch this content or any web browser that’s running on your mobile phones are the clients to H. T. T. P. and the servers for H. T. T. P. are all those web applications like YouTube, Facebook that is sitting on the cloud owned by different companies and just on the internet.
All right so point number one really basic client-server model https //www.twitch.tv/activate and that’s what H. T. T. P. follows.
H.T.T.P is a stateless protocol
The second really important thing to understand about H. T. T. P. is that it’s a stateless protocol and what do we mean by St Louis? What’s the list?
Kind of means is that every single transaction you make through H. T. T. P. is independent and is not related to any other transaction. So let’s just take a couple analogies like flipping a coin. Flipping a coin St Louis right heads, heads, heads, tails, tails.
Just because you got heads 5 times doesn’t mean you couldn’t get it with the same probability that next time right flipping a coin is stateless. So even though it’s H. T. T. P. is kind of a stateless protocol, you’ll see that a lot of web applications still track your state somehow right and they do this via these things called sessions, cookies, and a lot of kinds of state for management of how web applications work with all their clients.
But that’s for another content all right. So even though H. T. T. P. itself the stainless. You still get the functionality of the state through other mechanisms, so remember that.
H.T.T.P is an application layer protocol
The third important point about H. T. T. P. is that it’s an application layer protocol and it sits on top of the transport layer protocol. 99.9 percent of the case H. T. T. P. uses TCP assets. Transport level protocol.
So the transport layer, here the application layer is a little above it. All right in the stack of things, we can’t get into the details of T. C. P. in this content but what it really does is it defines how data is sent from one place to the other, and how the data is formatted, how the packets are sent.
You know how do you acknowledge things is kind of dictating the actual transport or the communication of the data itself that’s what TCP does. ACT peaks above that on the stack right. So from H. T. T. P. S.’s perspective, it doesn’t care about how their data send those are details that don’t care about all they care about is I request the webpage on it, and get some data back.
TCP handles
I request that the webpage get some data back. So it never cares about all those little details that TCP handles. So H. T. T. P. appears TCP right below it. All right also the forcing force important thing about this protocol is that whenever the client requests something from the server it always specifies a special action or method along with it.
If you’re a developer watching this content before, I’m sure you’ve heard of all these different methods or actions get. Post, the leap. But these are all special actions to be performed by the server get is really simple. I just want to get read a page.
It’s always read-only
All right it’s always read-only I want to get a resource post this year creating something new. So you’re creating a new item in your shopping cart or you’re creating a new friend on Facebook. Post is always for creating a new object and delete. Self-explanatory 50 most important thing about H. T. T. P. is that it defines response status codes that the servers make back to the clients.
I’m sure many of you have to counter some of these before 200 means a-okay 404 means not found, and 500 means you asked up. But if you look at the documentation for H. T. T. P. there. So there are a lot of these numbers defining what all the different status codes mean but what’s really difficult is that it’s actually up to the programmer to return the proper status codes and more often than not. You don’t really return the proper status code many times okay.
Headers
So the 6 and last point last court date to understand it but H. T. T. P. is that it supports these things called headers. All I had is it’s really simple all headers are tiny bits of custom information that you send along with your request and with your responses.
The main purpose of headers and all these custom little bits of information is the kind of tweak the operation of the requests. So let me just give a few examples to hopefully make it more clear. One header that you can include in the request side of things is the content type of the data that’s returned. So you could say I want a text file or one XML file or I wanna chase on file but it’s up to the client to be like.
I’m gonna I want some data but actually want to choose what type or the format of the data I want to get back. So it’s going to send a special header to be like I want it as a text file and the service going to recognize that and respond with a text file. So what we just talked about was actually a header that the client uses on the requesting side when they request stuff from the server.
Custom header
But on the flip side of that when the server comes back with its response it can also include custom headers. One really cool header that’s returned from the server is something called cache control and this is a really really cool optimization technique of the internet and actually kind of determines how all these different resources are cashed by all the different clients that are using them.
All right guys so those are just 2 quick examples of headers. The first course is that you have to remember always about headers that headers are included both in the request site and the response site. So you can include headers in both directions.
There’s no standard rule
The next thing to remember about headers is that there’s no standard rule book about headers. All right there are certain there are a lot of them that are kind of well defined like cache-control, content type.
The ones that we talked about those are well-defined headers but actually, you can send whatever custom information you want you can send a specific header that works just for your website and it’s just there are no rules.
So if you ever look at some of the requests and responses that are going across the network, there are all these random headers. Sometimes a real application-specific. All right so there’s no rule book for this.
Wrapping Up
All right guys that were 6 important things about H. T. T. P. that I just wanted to share with everyone. First, as I said at the beginning of this content understand this protocol. It’s still a really basic thing but to really understand how the internet works, how a web application works, how people hack stuff, and how people do security.
You have to understand H. T. T. P. first and that’s why I made this content first it’s going to serve as a good foundation for future content when we talk about more advanced things. All right, so hope you enjoyed the content.
Read more here.