[Web-SIG] Why is response_headers a list instead of a dict?
James Y Knight
foom at fuhm.net
Sun Dec 25 05:48:39 CET 2005
On Dec 24, 2005, at 10:45 PM, Clark C. Evans wrote:
> Why is response_headers a list instead of a dict?
>
> [ RFC quote ]
>
> In other words: (a) order does not matter
True, order between headers does not matter.
> (b) it is reasonable to
> restrict a header field to a single (header_name, header_value) pair.
Yes, the RFC says that, and I certainly wish it were true, but it's
simply not. The RFC lies. The primary example is the Set-Cookie
header, which by _definition_ cannot be combined, as it uses an
unquoted date which includes a comma. Also, multiple WWW-Authenticate
headers should be okay to combine, but I've heard rumors of UAs being
confused by that format.
WSGI could have spec'd a dictionary of lists of strings, rather than
a list of strings, but it did not. You can transform the result into
that if you like...
James
More information about the Web-SIG
mailing list