Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why HTTP protocol is designed in plain text way?

Yesterday, I have a discussion with my colleagues about HTTP. It is asked why HTTP is designed in plain text way. Surely, it can be designed in binary way just like TCP protocol, using flags to represents different kinds of method(POST, GET) and variables (HTTP headers). So, why HTTP is designed in such way? Is there any technical or historical reasons?

like image 393
Morgan Cheng Avatar asked Dec 26 '08 02:12

Morgan Cheng


People also ask

Is HTTP a plain text protocol?

HTTP requests and responses are sent in plaintext, which means that anyone can read them.

Is HTTP text based?

Like most of the Internet protocols http it is a command and response text based protocol using a client server communications model.

Which protocol sends the data in plain text?

FTP is easy to use and you have likely been using it for years. However, like telnet it sends your password as plain text.

What is HTTP in simple words?

HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files -- such as text, images, sound, video and other multimedia files -- over the web. As soon as a user opens their web browser, they are indirectly using HTTP.


2 Answers

A reason that's both technical and historical is that text protocols are almost always preferred in the Unix world.

Well, this is not really a reason but a pattern. The rationale behind this is that text protocols allows you to see what's going on on the network by just dumping everything that goes through. You don't need a specialized analyzer as you need for TCP/IP. This makes it easier to debug and easier to maintain.

Not only HTTP, but many protocols are text based (e.g., FTP, POP3, SMTP, IMAP).

You might want to take a look at The Art of Unix Programming for a much more detailed explanation of this Unix thing.

like image 140
PolyThinker Avatar answered Oct 07 '22 08:10

PolyThinker


With HTTP, the content of a request is almost always orders of magnitude larger than the protocol overhead. Converting the protocol into a binary one would save very little bandwidth, and the easy debugability that a text protocol offers easily trumps the minor bandwidth savings of a binary protocol.

like image 43
Adam Rosenfield Avatar answered Oct 07 '22 09:10

Adam Rosenfield