Skip to content

Conversation

MihaelIsaev
Copy link
Contributor

Added check to add host only if needed, and also building host the right way.

@swift-server-bot
Copy link

Can one of the admins verify this patch?

5 similar comments
@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

Copy link
Collaborator

@dnadoba dnadoba left a 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") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HTTPRequestHead is created in the lines above and we can therefore say for sure we will never have a host 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 the HTTPHeaders from the original request through the stack.

FYI: @rnro is currently working on moving HTTP1ProxyConnectHandler to swift-nio-extras in this PR. In this new version the HTTPHeaders are passed into the HTTP1ProxyConnectHandler.init which makes this a bit easier. We still need to get the original request headers to where we create the HTTP1ProxyConnectHandler in AHC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants