- Notifications
You must be signed in to change notification settings - Fork136
FixHost header (#650)#652
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
swift-server-bot commentedDec 6, 2022
Can one of the admins verify this patch? |
5 similar comments
swift-server-bot commentedDec 6, 2022
Can one of the admins verify this patch? |
swift-server-bot commentedDec 6, 2022
Can one of the admins verify this patch? |
swift-server-bot commentedDec 6, 2022
Can one of the admins verify this patch? |
swift-server-bot commentedDec 6, 2022
Can one of the admins verify this patch? |
swift-server-bot commentedDec 6, 2022
Can one of the admins verify this patch? |
dnadoba left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks! This is almost good to go.
| uri:"\(self.targetHost):\(self.targetPort)" | ||
| ) | ||
| head.headers.replaceOrAdd(name:"host", value:"\(self.targetHost)") | ||
| if !head.headers.contains(name:"host"){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
TheHTTPRequestHead is created in the lines above and we can therefore say for sure we will never have ahost set. This makes sense because we don't need to look into the headers we have created here but from the original HTTP request from the user. This will require plumping theHTTPHeaders from the original request through the stack.
FYI:@rnro is currently working on movingHTTP1ProxyConnectHandler toswift-nio-extrasin this PR. In this new version theHTTPHeaders are passed into theHTTP1ProxyConnectHandler.init which makes this a bit easier. We still need to get the original request headers to where we create theHTTP1ProxyConnectHandler in AHC.
Added check to add host only if needed, and also building host the right way.