Re:Anatomy of an Attack: How I Hacked StackOverflow (2012)
by jcranmer on Sunday July 26, 2015 @11:11PM
(#9953138)
Actually, most header fields don't allow comments. The most common one that does (User-Agent) isn't exactly necessary for processing, and is its own little world of bizarre pain.
There's a lot of historical header abuse caused by the fact that HTTP sort of shared a syntax with email MIME headers, but HTTP implementations have generally started treating such abuses as malformed. (MIME on the other hand still hasn't. It's actually quite gory.)
This same issue exists on many VoIP networks as they share the same broken parsing ideas (in SIP).
1: HTTP allows you to line wrap headers and add comments. It's stupidly bizarre. It comes from the 70s or 60s where you wouldn't have a client program, so human-formatted headers weren't just a debug benefit, but a necessary requirement. The IETF can be rather clueless, so they blindly copy these terrible ideas into new protocols, like HTTP and SIP.