Repository navigation
Add connectHeaders to Proxy for HTTP CONNECT tunneling - #281
Merged
Merged
Conversation
Exposes async-http-client's connectHeaders (swift-server/async-http-client#912, available since the pinned 1.36.0) through Proxy, composed as a Property builder the same way Form scopes its own per-part headers — resolves the Headers subtree via _makeProperty + search(for: HeaderNode.self) into a local HTTPHeaders value instead of writing into the main request headers. Internals.Proxy gains a connectHeaders field, threaded only through the .http branch of build(); excluded from Hashable since NIOHTTP1.HTTPHeaders isn't, mirroring how async-http-client's own Proxy handles the same constraint. Implements #279.
import RequestDLInternals sat between the doc block and the struct declaration with no blank line, so the comment documented the import statement instead of Proxy itself. Moved the import above the doc.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
=======================================
Coverage 98.24% 98.24%
=======================================
Files 3 3
Lines 857 857
=======================================
Hits 842 842
Misses 15 15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
connectHeaderstoProxy, exposing async-http-client'sconnectHeaders(add proxy-header support swift-server/async-http-client#912, available since the pinned1.36.0) — extra headers sent only on the HTTPCONNECTrequest used to establish the proxy tunnel.connectHeadersis composed as aPropertybuilder, the same wayFormscopes its own per-part headers:Proxybecomes generic overHeaders: Property, and a new init resolves that subtree via_makeProperty+search(for: HeaderNode.self)into a localHTTPHeadersvalue, entirely separate from the request's own headers.Internals.Proxygains aconnectHeadersfield, threaded only through the.httpbranch ofbuild(). Excluded fromHashable—NIOHTTP1.HTTPHeadersisn'tHashable— mirroring howasync-http-client's ownProxytype handles the same constraint.authorization:andconnection:) are unchanged, constrained toHeaders == EmptyProperty.Marked
breaking-changesbecauseProxyis now generic (Proxy<Headers: Property>) — source-compatible for every existing call site, but any code that spells the type explicitly (e.g.let p: Proxy) needsProxy<EmptyProperty>.Implements #279.
Test plan
swift test --filter RequestDLTests.ProxyTestsswift test --filter RequestDLInternalsTests.InternalsProxyTestsswift test(full suite, 1103 tests)swift format lint --recursive --strict Sources Tests