Possible Duplicate:
Why HTTP protocol is designed in plain text way?
To show my complete ignorance of how TCP/IP works: Looking at 开发者_StackOverflow社区the ASCII table, what is the rationale of HTTP using only tab, newline and [x20-x7E]
for the protocol?
For example, why is "x02" ("Start of Text") not used but a double newline "x0Ax0A"?
Has it to do with any interference with TCP/IP (as in "is not allowed in Application Layer")? Is there perhaps a more trivial reason? Or a more complicated?
Duplicate of this question: Why HTTP protocol is designed in plain text way?.
Text-based protocols are easier to debug - no need for special formatting/decoding routines in your debug print code, just dump the entire request to the console. Likewise, you can make a HTTP request just by typing it into an appropriate generic TCP relay program (eg, netcat).
I can't speak as to why HTTP chose to use that particular restricted character set, but it doesn't have to do with the restrictions of TCP/IP. TCP/IP packets are structured more or less like an envelope; they have complex routing and formatting information that must be stored in a very specific format, but the actual contents of the packet payloads can be whatever you choose. The packet headers contain enough information to allow for forwarding and transmission regardless of the packet content.
精彩评论