-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Multiple Set-Cookie headers folded into one value #4520
Comments
Hi @DanHoerst, thanks for bringing this up. This is actually a duplicate of #3957 and yes it is a current issue with Requests header parsing implementation. As noted in the tracking issue, the cookies are still available separately in the cookie jar which is the preferred interface for this. I'm gonna close this as a dupe and we can follow up in the original as needed. |
There's also the underlying header structure that urllib3 uses which is always available and represents values like this correctly. |
@sigmavirus24 Thanks. Do you have an example of how to access that from a Requests response object? |
@DanHoerst, |
When Python Requests is used to contact a server which returns multiple
Set-Cookie
response headers, Python Requests combines them into one header field with the values separated by commas.Expected Result
Using Nginx as my origin server with the following config:
Contacting this origin server I expect to receive two separate
Set-Cookie
headers with their corresponding values. As per RFC6265:When using the browser my response from this origin has multiple
Set-Cookie
headers:Actual Result
Python Requests folds the multiple
Set-Cookie
headers into a single header field separated by comma(s). For example:Reproduction Steps
docker run -itd -p 80:80 nginx
)Set-Cookie
headersSet-Cookie
headers (screenshot above)Set-Cookie
header (code above)System Information
Jupyterhub is an example of where this is a problem in the wild: jupyterhub/jupyterhub#1657
The text was updated successfully, but these errors were encountered: