Setting multiple headers is not(?) supported in response #287

Closed
bra-fsn opened this Issue Jul 26, 2011 · 4 comments

Comments

2 participants

bra-fsn commented Jul 26, 2011

During the development of a HTTP proxy (which uses flask for the response view generation) I came into the issue of setting multiple header values.
The problem is that I get multiple Set-Cookies response from the upstream HTTP server, which I have to insert into flask's response. But currently it seems it's impossible due to the dictionary interface.
Any ideas?

Owner

mitsuhiko commented Jul 26, 2011

Use resp.headers.add('key', 'value') instead of resp.headers['key'] = 'value' to set more than one.

@mitsuhiko mitsuhiko closed this Jul 26, 2011

bra-fsn commented Jul 27, 2011

This way I get one Set-Cookie header, which it seems not really the same as having two (the application first expires the cookie then sets a new, in two Set-Cookie headers).

Owner

mitsuhiko commented Jul 27, 2011

You mean something else replaces the header? Can you provide a testcase?

bra-fsn commented Jul 28, 2011

Well, I'm not quite an expert of browsers.
The main issue is/was is this:
http://drupal.org/node/191616
Drupal sends two set-cookie headers when authenticating and that's what I would like to 'proxy' to the client and this is what I have problems with.
But after reading that the solution is easy: I should drop the first (invalid) cookie and only use the second. Which is not quite easy to get from httplib either (there's another case for that with the solution).
So sorry for the noise, this is a Drupal idiotism for which I could find the solution.

Thanks for the great job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment