-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsLLA 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. fixes #59341 HTTP 400 ("Invalid Host header") for link-local IPv6 addresses
|
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpAuthority.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs
Show resolved
Hide resolved
// 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; |
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.
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?
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.
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.
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