title: what is the exact syntax and semantics of a quoted string in the http1.1 rfc2616
body: <p>In the <a href="http://www.ietf.org/rfc/rfc2616.txt" rel="nofollow noreferrer">rfc2616</a> which is the HTTP/1.1 standard, a quoted string is defined as follows.</p>
  <pre><code>quoted-string  = ( &lt;&quot;&gt; *(qdtext | quoted-pair ) &lt;&quot;&gt; )
  quoted-pair    = &quot;\&quot; CHAR
  CHAR           = &lt;any US-ASCII character (octets 0 - 127)&gt;
  qdtext         = &lt;any TEXT except &lt;&quot;&gt;&gt;
  TEXT           = &lt;any OCTET except CTLs, but including LWS&gt;
  </code></pre>
  <p>With this definition &quot;&quot; seems to be a TEXT, and therefore <code>&lt;&quot;&gt;\&lt;&quot;&gt;</code> (quote, backslash, quote) seems to be a valid quoted string. But this contradicts the proper usage of backslash as escape character and can even lead to not unambiguously being able to determine the end of the quoted string. Where is my error here?</p>
  <p>The RFC also states</p>
  <pre><code>LWS            = [CRLF] 1*( SP | HT )
  All linear
  white space, including folding, has the same semantics as SP. A
  recipient MAY replace any linear white space with a single SP before
  interpreting the field value or forwarding the message downstream.
  </code></pre>
  <p>I have read the interpretation that even LWS inside quoted strings can be replaced by SP. If I take the RFC literally that's what it says. I am puzzled by this, since this means the quoted strings &quot; &quot;, &quot;\n &quot;, &quot;\n\t \t \t&quot;, … are all the same. Can those quoted strings really not be semantically distinguished?</p>