Are there any problems with multiple cookies?
Some servers return multiple Set-Cookie headers, but urllib3 stores the headers in a dict, and dict does not allow multiple records with the same key.
httplib2 has a similar problem.
Or maybe not: it turns out that the readheaders method of the HTTPMessage class in the httplib package, which is used by both urllib3 and httplib2, has the following comment:
If multiple header fields with the same name appear, they are combined in accordance with RFC 2616 with 4.2:
Appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is significant to the interpretation of the combined field value.
Thus, no headers are lost.
However, there is a problem if there are commas in the header value. I still do not understand what is happening here, but from skimming RFC 2616 ("Hypertext Transfer Protocol - HTTP / 1.1") and RFC 2965 ("HTTP State Control Mechanism") I get the impression that any commas in the header should have a value indicated.
Rod montgomery
source share