Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
dmex committed Dec 25, 2024
1 parent 2a2522b commit 1a2b9ad
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions tools/CustomBuildTool/HttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,18 @@ namespace CustomBuildTool
{
public static class HttpClient
{
private static System.Net.Http.HttpClient HttpMessageClient = null;
private static System.Net.Http.HttpClientHandler HttpClientHandler = null;

public static System.Net.Http.HttpClient CreateHttpClient()
{
if (HttpMessageClient == null)
{
HttpClientHandler = new HttpClientHandler();
HttpClientHandler.AutomaticDecompression = DecompressionMethods.All;
HttpClientHandler.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13;
var httpClientHandler = new HttpClientHandler();
httpClientHandler.AutomaticDecompression = DecompressionMethods.All;
httpClientHandler.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13;

System.Net.Http.HttpClient httpClient = new System.Net.Http.HttpClient(HttpClientHandler);
httpClient.DefaultRequestVersion = HttpVersion.Version20;
httpClient.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrHigher;
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("CustomBuildTool", "1.0"));
}
var httpClient = new System.Net.Http.HttpClient(httpClientHandler);
httpClient.DefaultRequestVersion = HttpVersion.Version20;
httpClient.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrHigher;
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("CustomBuildTool", "1.0"));

return HttpMessageClient;
return httpClient;
}

public static HttpResponseMessage SendMessageResponse(HttpRequestMessage HttpMessage)
Expand Down

0 comments on commit 1a2b9ad

Please # to comment.