tool: enable header separation when using a proxy#20398
Closed
jacekmigacz wants to merge 1 commit intocurl:masterfrom
Closed
tool: enable header separation when using a proxy#20398jacekmigacz wants to merge 1 commit intocurl:masterfrom
jacekmigacz wants to merge 1 commit intocurl:masterfrom
Conversation
When using a proxy, --header specified headers were leaking into CONNECT requests. This could break corporate proxies that reject custom User-Agent headers in CONNECT. Enable CURLHEADER_SEPARATE only for HTTPS through proxy or when --proxytunnel is used, ensuring: - --header affects only HTTP requests (not CONNECT) - --proxy-header affects only CONNECT requests - --user-agent affects both consistently Fixes the redirect + proxy + custom UA issue while maintaining compatibility with HTTP proxy scenarios.
765fa88 to
24d4f61
Compare
|
Analysis of PR #20398 at 24d4f611: Test 3023 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 12 different CI jobs (the link just goes to one of them). Generated by Testclutch |
bagder
approved these changes
Jan 22, 2026
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CURLHEADER_SEPARATE was only set when --proxy-header was used, causing --header content to leak into CONNECT requests. This breaks some corporate proxies when custom User-Agent headers are specified.
Enable CURLHEADER_SEPARATE whenever --proxy is configured to ensure proper header separation:
Before:
$ curl --proxy proxy:3128 --header "User-Agent: custom" https://example.com
After:
$ curl --proxy proxy:3128 --header "User-Agent: custom" https://example.com