http: clear the proxy credentials as well on port or scheme change#21304
http: clear the proxy credentials as well on port or scheme change#21304bagder wants to merge 3 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
938b90b to
ab91040
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes credential handling across redirects where a scheme/port change causes libcurl to switch proxies, ensuring proxy credentials from the previous proxy do not “stick” to the next proxy. It also adds new regression tests to cover proxy switching with and without explicitly provided proxy credentials.
Changes:
- Add
Curl_reset_userpwd()helper and use it during pretransfer setup and redirect-follow auth clearing. - Update redirect-follow logic to reset proxy credentials when clearing auth on scheme/port changes.
- Add new tests
test2009/test2010plus a small tweak intest795, and register new tests intests/data/Makefile.am.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
lib/transfer.c |
Introduces Curl_reset_userpwd() and reuses it in Curl_pretransfer(). |
lib/transfer.h |
Exposes Curl_reset_userpwd() for internal callers (e.g., HTTP redirect handling). |
lib/http.c |
Calls Curl_reset_userpwd() when clearing auth on redirect port/scheme changes. |
tests/data/test2009 |
New test: ensures env-provided proxy creds don’t leak when redirect switches from http_proxy to https_proxy. |
tests/data/test2010 |
New test: ensures --proxy-user creds still apply across a proxy switch driven by redirect. |
tests/data/test795 |
Replaces a hard-coded base64 blob with %b64[...]b64% equivalent for IMAP AUTH PLAIN. |
tests/data/Makefile.am |
Registers the new tests in the test case list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add test 2009 and 2010 to verify switching between proxies with credentials when the switch is driven by a redirect Reported-by: Dwij Mehta Closes #21304
e6589de to
d6464f9
Compare
|
augment review |
🤖 Augment PR SummarySummary: This PR hardens HTTP redirect handling so proxy credentials do not leak when the effective proxy changes due to a redirect. Changes:
Technical notes: The new tests validate that 🤖 Was this summary useful? React with 👍 or 👎 |
Add tests 2009-2011 to verify switching between proxies with credentials when the switch is driven by a redirect Reported-by: Dwij Mehta Closes curl#21304
Add test 2009 to verify switching between proxies with credentials when the switch is driven by a redirect
Reported-by: Dwij Mehta