From 7f119498f7b41e7787d1b6ea554cbb6b906e90f4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 22 Jul 2024 12:23:59 -0400 Subject: [PATCH] fix: all is not available in older runtimes Signed-off-by: Vincent Biret --- src/http/httpClient/KiotaClientFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/http/httpClient/KiotaClientFactory.cs b/src/http/httpClient/KiotaClientFactory.cs index a8bce0b7..5a89c01a 100644 --- a/src/http/httpClient/KiotaClientFactory.cs +++ b/src/http/httpClient/KiotaClientFactory.cs @@ -165,11 +165,11 @@ public static HttpMessageHandler GetDefaultHttpMessageHandler(IWebProxy? proxy = // If custom proxy is passed, the WindowsProxyUsePolicy will need updating // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs#L575 var proxyPolicy = proxy != null ? WindowsProxyUsePolicy.UseCustomProxy : WindowsProxyUsePolicy.UseWinHttpProxy; - return new WinHttpHandler { Proxy = proxy, AutomaticDecompression = DecompressionMethods.All, WindowsProxyUsePolicy = proxyPolicy, SendTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveDataTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveHeadersTimeout = System.Threading.Timeout.InfiniteTimeSpan, EnableMultipleHttp2Connections = true }; + return new WinHttpHandler { Proxy = proxy, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, WindowsProxyUsePolicy = proxyPolicy, SendTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveDataTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveHeadersTimeout = System.Threading.Timeout.InfiniteTimeSpan, EnableMultipleHttp2Connections = true }; #elif NET5_0_OR_GREATER return new SocketsHttpHandler { Proxy = proxy, AllowAutoRedirect = false, EnableMultipleHttp2Connections = true, AutomaticDecompression = DecompressionMethods.All }; #else - return new HttpClientHandler { Proxy = proxy, AllowAutoRedirect = false, AutomaticDecompression = DecompressionMethods.All }; + return new HttpClientHandler { Proxy = proxy, AllowAutoRedirect = false, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }; #endif } }