We have an example of CORS information on line 5 - 6, Media Type information on line 4, and something we will explain here in a minute line 2 has information about the connection. All kinds of information can be passed in through here. The headers are lines 2 - 10, and are used as meta information about the response. A table of the commonly used ones are in RFC 7231 Section 6.
The 200 is the numerical status and OK is the text repesentation. So in the example above Line 1 shows 200 OK. This has information about what exactly the server has done with the request in a numerical and a textual representation. In a response, the start-line is actually the status-line. A request and a response are nearly the same thing. If you’ve been following along this may seem highly similar to a request, and you would be right. There are 3 major parts to a response (and if you want to follow the spec Section 3 of RFC 7230) The start-line, the headers then the body.
If we had not included the host header, this particular server returns with an error. Again, that is glossing over the details greatly, but that is why we included it in our example. This is because multiple servers could be hosted at that IP and this is what routes us to the right server. To put it simply, this says please send to host named. The header we sent in the above example is only 1 line which is Host:. Which can be 0 or more depending on what you are doing. The next lines are defined as the request header. What it basically says that you get the following: That very first line is called the start-line of the HTTP request and is defined in RFC 7230 Section 3.1.1.
After we’ve established a connection to port 80 on a server, we can send plain text of our request to a server. Now, lets make our first HTTP call with telnet: This was one of the better, simpler services out there that I found as a good playground to work with. I am going to be using in these following examples. But you may learn something about HTTP and what it can actually do. Yes, its long and there are a lot of pieces to it. If you’ve never looked at the what makes up the HTTP standard, I encourage you to start with RFC 7231 or it’s parent RFC 7230.
#How to use telnet to get http how to#
I highly recommend reading the wikipedia page on the RFCs, or even read up on the spec of how to make a RFC! There is a beautiful process that started very early on how exactly certain things were going to be set in stone and work over the internet. We want to know that we are doing the right thing at the right time, and people much brighter then we have paved that path already. Standards: that beautiful thing we all strive for as programmers. So I thought it was fitting to start by looking at the basics of the communication mechanism we build upon and use every day, HTTP. And I’ve found through out the years that a surprising number of web developers don’t know how it works. Have you ever tried to talk to a HTTP server via Telnet?Īs web developers, either front end or backend, we should strive to at least strive to have a understanding of the technologies we build our success on.