'Http/2 HttpClient and HPACK For APNs
I am writing code to send notifications to the Apple push notification servers (APNs). It says in the documents that it requires HTTP/ HPACK header compression. I found the following code to use HTTP/2 with C# httpclient:
public class Http2CustomHandler : WinHttpHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
request.Version = new Version("2.0");
return base.SendAsync(request, cancellationToken);
}
}
using (var httpClient = new HttpClient(new Http2CustomHandler()))
{
}
Does that compress the headers that I will add to the HttpClient automatically or should I add the header data some other way?
Solution 1:[1]
Yes it does compress the headers. You don't have to do anything extra.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Andrei |
