-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
WinHttpHandler HTTP/2 trailing headers #44778
Comments
Tagging subscribers to this area: @dotnet/ncl Issue Details
|
Example of what hacking in trailing headers could look like: public static HttpResponseHeaders GetTrailingHeaders(this HttpResponseMessage responseMessage)
{
#if !NET472
return responseMessage.TrailingHeaders;
#else
if (!responseMessage.RequestMessage.Properties.TryGetValue("__Http2ResponseTrailingHeaders", out var headers))
{
throw new InvalidOperationException();
}
return (HttpResponseHeaders)headers;
#endif
} |
Triage: Making it compatible with .NET Core 3.0+ makes sense. |
Following up on #46602 (comment) I also think that we should continue API discussions here, under the issue, before going further with implementation details. At the moment I'm a bit pessimistic, since I don't see a good way to expose this without going against established BCL practices. A list of challanges I see:
The best thing I can think of to overcome these challanges is to introduce an extension method within the WinHttpHandler lib, so we can at least hide some of this mess: [Edit] Changed the proposal so the method throws WinHttpException instead of returning false. public static class WinHttpExtensions
{
// Returns a header collection if WINHTTP_QUERY_FLAG_TRAILERS is supported, throws WinHttpException otherwise.
// Hides the access of the property bag as an implementation detail.
// We may decide to also set HttpResponseMessage.TrailingHeaders for consistency, but the recommended way to access them is to use the extension method.
[SupportedOSPlatform("windows10.0.BUILD")]
public static HttpResponseHeaders GetWinHttpTrailingHeaders(this HttpResponseMessage responseMessage);
} |
I believe a The constructor for |
WinHTTP has added support for HTTP/2 trailing headers in modern versions of Windows.
WinHttpHandler should set trailers into the
HttpResponseMessage.TrailingHeaders
collection in .NET Core 3+.An idea that the gRPC team is thinking about is using WinHttpHandler to support
Grpc.Net.Client
on .NET Framework. For that to work the trailing headers would need to be available in .NET Framework, which doesn't have theHttpResponseMessage.TrailingHeaders
API.A possible solution that doesn't involve adding new API to .NET Framework could be to set the trailing headers collection as a value in
HttpRequestMessage.Properties
using a known key, e.g.__Http2ResponseTrailingHeaders
.The text was updated successfully, but these errors were encountered: