Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the handling of Set-Cookie in http responses #121

Closed
wants to merge 2 commits into from
Closed

Updating the handling of Set-Cookie in http responses #121

wants to merge 2 commits into from

Conversation

dwnichols
Copy link
Contributor

Two small changes to more accurately handle Set-Cookie.

First commit, to handle a response with two cookies in the response header. Commit comment:
When an http response has two Set-Cookie in the header, response['Set-Cookie'] will return a single string. This string will be the two returned cookies separated by a comma, concatenated together. Instead this should use get_fields('Set-Cookie') which returns an array of returned cookie strings.

Second commit to allow '=' within a cookie value. Commit comment:
The syntax of cookies is described in http://www.ietf.org/rfc/rfc2109.txt, section 4.1. Cookies are attribute-value pairs, so split should only return 2 values. This will allow '=' within the value of a cookie.

…-Cookie'] will return a single string. This string will be the two returned cookies separated by a comma, concatenated together. Instead this should use get_fields('Set-Cookie') which returns an array of returned cookie strings.
….txt, section 4.1. Cookies are attribute-value pairs, so split should only return 2 values. This will allow '=' within the value of a cookie.
@jnunemaker
Copy link
Owner

Sorry for overlooking this. Looks good, just needs some specs. If you could add them, I'll happily pull.

@jnunemaker
Copy link
Owner

Closing. Please re-open if you add specs and get it working. Thanks!

@jnunemaker jnunemaker closed this Jan 1, 2013
@azurewraith
Copy link

+1, ran into this today.

@farleyknight
Copy link

+1 Same here.

@jnunemaker
Copy link
Owner

I'm more interested in a pull request that I can maintain than +1's right now, but thanks for letting me know. If either of you would like to tackle, I'd love it.

@dwnichols
Copy link
Contributor Author

Oddly, I am not able to reopen this or push directly to the above commits, so here's updated commits with tests.

bd32f52
45fdfd8

@jnunemaker
Copy link
Owner

Can you just open a new pull request? Thanks!

@dwnichols
Copy link
Contributor Author

Not a problem! See pull request 218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants