Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix invalid Host header for link-local IPv6 #69203

Merged
merged 2 commits into from
May 12, 2022
Merged

fix invalid Host header for link-local IPv6 #69203

merged 2 commits into from
May 12, 2022

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented May 11, 2022

LLA are difficult to deal with. We need to preserve the ScopeID and pass it to Socket.Connect. But they should not be part of the Host header. The ScopeId is basically index of local interface and makes no sense to the peer. It still needs to be surrounded by brackets as any other IPv6.

To preserve both, I added extra field to HttpAuthority so we don't need to figure it out later from the string.
They would be identical for everything but LLA.

fixes #59341 HTTP 400 ("Invalid Host header") for link-local IPv6 addresses

@wfurt wfurt requested review from Tratcher, stephentoub and a team May 11, 2022 19:42
@wfurt wfurt self-assigned this May 11, 2022
@ghost
Copy link

ghost commented May 11, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

LLA are difficult to deal with. We need to preserve the ScopeID and pass it to Socket.Connect. But they should not be part of the Host header. The ScopeId is basically index of local interface and makes no sense to the peer. It still needs to be surrounded by brackets as any other IPv6.

To preserve both, I added extra field to HttpAuthority so we don't need to figure it out later from the string.
They would be identical for everything but LLA.

fixes #59341 HTTP 400 ("Invalid Host header") for link-local IPv6 addresses

Author: wfurt
Assignees: wfurt
Labels:

area-System.Net.Http

Milestone: -

// Note: Disposing the HttpClient object automatically disposes the handler within. So, it is not necessary
// to separately Dispose (or have a 'using' statement) for the handler.
public abstract class HttpClientHandlerTest : HttpClientHandlerTestBase
{
public static bool IsNotWinHttpHandler = !IsWinHttpHandler;
Copy link
Member

@stephentoub stephentoub May 12, 2022

Choose a reason for hiding this comment

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

What does WinHttpHandler do for these inputs? Is it doing it "wrong", and if so, is that an issue with WinHttpHandler or with winhttp? Do we have WinHttpHandler tests for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

It hangs for the newly added LLA. I did packet capture and it is failing to even connect e.g. there is no SYN going out. So it seems like the trick with tho proxy does not work in this case for some reason.
I could possibly add skip just for that one or split it to multiple cases but I was not sure how much we should twist because of winhttp.

@wfurt wfurt merged commit e502177 into dotnet:main May 12, 2022
@wfurt wfurt deleted the lla branch May 12, 2022 17:16
@ghost ghost locked as resolved and limited conversation to collaborators Jun 11, 2022
@karelz karelz added this to the 7.0.0 milestone Jul 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP 400 ("Invalid Host header") for link-local IPv6 addresses
3 participants