How can telnet client act as Http client?
I was just reading this article and got surprised when it said that you can use telnet to send HTTP requests. But, isn't #telnet an application-layer protocol of its own? isn't it supposed to be something different than http protocol? No where is written that telnet is built on top of HTTP. So how is it possible for an HTTP server to interpret sequence of zeros and ones coded due to telnet protocol? and even return some response that telnet client can understand!
The puzzle gets solved if we fully dive into details of telnet and how it works. (And we people never take that approach :) )
The second solution is to stick to simple clarifications in Q&As and university text books, as I did and I'm gonna share what I found.
What is telnet:
"Remote terminal protocol of the Internet architecture. Telnet allows you to interact with a remote system as if your terminal is directly connected to that machine." (Peterson, Computer Networks, 5th edition)
So it seems like an ancestor of today's SSL/SSH, though SSL is a presentation layer protocol!
What does Telnet do:
It's a text oriented protocol. It simply opens a TCP connection to the server and then transmits whatever you type BLINDLY to the socket (this SO post suggests so) So that it is capable of emulating any text-oriented protocol built on top of TCP. Telnet client can connect to port 80(http) or 25 (SMTP) it is not limited to its own port! As an example this link describes how to use telnet to emulate SMTP. The afforsaid book has some exercises to do the same task(see page 793 of 5th edition)
So it is the user who writes HTTP requests (HTTP is text-oriented too) within telnet connection not that the HTTP server understands the telnet commands.
Due to what we have so far said, telnet should belong to the 5th layer (session layer) But it doesn't because capabilities of telnet is beyond establishing the connection. as the definition said, it is used to utilize virtual terminal, and has specific commands for setting arguments and etc.
The simple fact behind using telnet client as http client is that we are not using those telnet specific commands and just writing some valid http requests into socket!
https://stackoverflow.com/questions/4731505/how-http-servers-accepts-telnet#answer-4731551
https://www.ionos.com/digitalguide/server/tools/telnet-the-system-wide-remote-protocol/
#cs_internship #web #step4