Skip to content

Fix Cookie handling as per RFC 6265 Section 5.4 #104

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

Merged
merged 1 commit into from
Oct 15, 2018
Merged

Conversation

gnat42
Copy link
Contributor

@gnat42 gnat42 commented May 8, 2018

Concatenate multiple cookies

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes #54
License MIT

What's in this PR?

Makes the cookie plugin only add one cookie header with all cookies separated by ;

Checklist

  • Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix

To Do

  • Need to add tests - I couldn't figure out the phpspec syntax, where the RequestInterface was being created etc. But I'm willing to add if someone can give me some pseudo code.

@gnat42
Copy link
Contributor Author

gnat42 commented May 8, 2018

I should note this is a similar solution to guzzle's CookieJar

@joelwurtz
Copy link
Member

Totally approve here, for the reference, the specification say that:

the user agent MUST NOT attach more than one Cookie header field.

Would you like help for adding test ? Or if you don't have time i can do them. But former solution would be nice, and we can help you better in our Slack channel

@dbu
Copy link
Contributor

dbu commented Jun 22, 2018

Joel, do you have time to add the test so we can merge this fix?

@Nyholm
Copy link
Member

Nyholm commented Aug 14, 2018

I would like to merge this PR. Joel, do you still want to work with the test?

@joelwurtz
Copy link
Member

No time ATM, sorry for the delay :/

@gnat42
Copy link
Contributor Author

gnat42 commented Aug 20, 2018

I don't mind writing the tests and do have a few spare cycles but was just extremely lost as to the test syntax, if someone can point me to some docs I can take a stab at it again.. I may review again anyway since perhaps I hadn't had enough sleep the first time I looked at the tests in this project...

@gnat42
Copy link
Contributor Author

gnat42 commented Oct 11, 2018

I have no idea why I thought it was so complicated the first time. Writing a test was quite easy. I must have been sleep deprived the first time. It'd be great to get this fixed, merged and released.

Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks correct to me.

its technically allowed to have multiple of the same header and the server is expected to use all such headers, but its indeed unexpected. i like this solution better.

@dbu
Copy link
Contributor

dbu commented Oct 11, 2018

can you please add an entry to CHANGELOG.md ? i'd label it as a "cleanup", its not strictly a bugfix ;-)

@gnat42
Copy link
Contributor Author

gnat42 commented Oct 12, 2018

I think the latest test failure is unrelated to my change..

@dbu dbu merged commit 5496bf2 into php-http:master Oct 15, 2018
@dbu
Copy link
Contributor

dbu commented Oct 15, 2018

thanks a lot! that failure looks like a temporary network problem. merged your change.

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.

CookiePlugin adds multiple Cookie headers to the Request
4 participants