I'm trying to write simple proxy server for some purpose. In it I use httplib to access remote web-server. But there's one problem: web server returns TWO Set-Cookie headers in one response, and httplib mangles them together in httplib.HTTPResponse.getheaders(), effectively joining cookies with comma [which is strange, because getheaders returns a LIST, not DICT, so I thought they wrote it with multiple headers of the same name). So, when I send this joined header back to client, it confuses client. How can I obtain full list of headers in httplib (without just splitting Set-Cookie header on commas)?
Asked
Active
Viewed 3,101 times
1 Answers
4
HTTPResponse.getheaders()
returns a list of combined headers (actually my calling dict.items()
). The only place where incoming headers are stored untouched is HTTPResponse.msg.headers
.

Denis Otkidach
- 32,032
- 8
- 79
- 100