tags:

views:

302

answers:

1

Hello! 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)?

+2  A: 

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
Thanks a lot! It really helped :)
Rivka