httpheader
httpheader copied to clipboard
Improve handling of media type escaping according to RFC 723x
According to Section 3.2.3:
Senders SHOULD NOT escape octets in quoted-strings that do not require escaping (i.e., other than DQUOTE and the backslash octet).
However, currently quote_string() escapes SEPARATOR characters that does not need to be escaped:
>>> print quote_string('test/one two\\ @three')
"test\/one\ two\\\ \@three"
They rather should be:
>>> print quote_string('test/one two\\ @three')
"test/one two\\ @three"