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

bug: Android proxy not setting all cookies, only sets last set-cookie header #5780

Closed
tlancina opened this issue Jul 20, 2022 · 2 comments
Closed

Comments

@tlancina
Copy link
Contributor

Bug Report

Platform(s)

Android

Current Behavior

If there are multiple Set-Cookie headers on a proxied response, only the last one is set.

Expected Behavior

It should set all of the cookies.

Code Reproduction

Run a server that responds to http://localhost:8000 with two Set-Cookie headers, ie:

printf "HTTP/1.1 200 OK\r\nSet-Cookie: a=123\r\nSet-Cookie:b=456\r\n\r\nHello World\r\n" | nc -l 8000

Then run:
https://github.com/tlancina/cap-cookie-repro

Other Technical Details

String cookie = conn.getHeaderField("Set-Cookie");

From https://developer.android.com/reference/java/net/URLConnection#getHeaderField(java.lang.String): "If called on a connection that sets the same header multiple times with possibly different values, only the last value is returned."

@tlancina
Copy link
Contributor Author

Closing as dup of #5394

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants