Do not eliminate duplicate Set-Cookie headers. #199

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

bfrog commented Apr 16, 2012

This fixes issue #195 and allows multiple response Set-Cookie headers using set_resp_cookie

@essen essen commented on the diff Apr 17, 2012

src/cowboy_http_req.erl
@@ -835,6 +835,8 @@ response_head(Status, Headers, RespHeaders, DefaultHeaders) ->
-> cowboy_http:headers().
merge_headers(Headers, []) ->
Headers;
+merge_headers(Headers, [{<<"Set-Cookie">>=Name, Value}|Tail]) ->
+ merge_headers(Headers ++ [{Name, Value}], Tail);
@essen

essen Apr 17, 2012

Owner

Hm do we need the ++ here?

@bfrog

bfrog Apr 17, 2012

Contributor

Its true of the line below that existed before this, I asked about it before and you simply said there was a reason but you couldn't remember.

I can make another patch if you accept this one that tries to remove the ++'s in merge_headers and see if that causes problems for anyone.

@essen

essen Apr 17, 2012

Owner

I have no idea! Will look sometimes.

Owner

essen commented Apr 30, 2012

Can we have a ct test for this? Also, does it work with 'Set-Cookie'? Thanks.

Contributor

bfrog commented Apr 30, 2012

Do we allow 'Set-Cookie' in place of <<"Set-Cookie">> currently? set_resp_cookie uses <<"Set-Cookie">>

Owner

essen commented Apr 30, 2012

Cookies can be set manually. Didn't look if at this point it'd be converted to binary yet, it's just something to check.

Owner

essen commented May 4, 2012

At the point where you are doing it everything should be in binary.

Owner

essen commented May 21, 2012

Just needs a test for this. Would be good to have before 0.6. :)

Contributor

josevalim commented Aug 13, 2012

This can be closed in favor of the pull request #247.

Owner

essen commented Aug 13, 2012

Thanks guys.

essen closed this Aug 13, 2012

@bfrog bfrog added a commit to treetopllc/cowboy that referenced this pull request Oct 17, 2012

@josevalim @bfrog josevalim + bfrog Do not remove duplicated Set-Cookie entries
This commit closes #195, closes #199, closes #246.
8a6daf0

@bfrog bfrog added a commit to treetopllc/cowboy that referenced this pull request Nov 26, 2012

@josevalim @bfrog josevalim + bfrog Do not remove duplicated Set-Cookie entries
This commit closes #195, closes #199, closes #246.
7028577
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment