way to disable http2 (#1120)

* way to disable http2

* no option for netstand2.0
This commit is contained in:
Boshi Lian
2022-12-13 14:13:35 -08:00
committed by GitHub
parent 4f801eaae1
commit 72c32c8b1b
3 changed files with 16 additions and 1 deletions

View File

@@ -27,6 +27,9 @@ namespace k8s
CreateHttpClient(handlers, config);
InitializeFromConfig(config);
HttpClientTimeout = config.HttpClientTimeout;
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
DisableHttp2 = config.DisableHttp2;
#endif
}
private void ValidateConfig(KubernetesClientConfiguration config)

View File

@@ -47,6 +47,10 @@ namespace k8s
private HttpClientHandler HttpClientHandler { get; set; }
#endif
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
private bool DisableHttp2 { get; set; }
#endif
/// <summary>
/// Initializes client properties.
/// </summary>
@@ -108,7 +112,10 @@ namespace k8s
};
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
if (!DisableHttp2)
{
httpRequest.Version = HttpVersion.Version20;
}
#endif
// Set Headers
if (customHeaders != null)

View File

@@ -103,5 +103,10 @@ namespace k8s
#else
public Action<HttpClientHandler> FirstMessageHandlerSetup { get; set; }
#endif
/// <summary>
/// Do not use http2 even it is available
/// </summary>
public bool DisableHttp2 { get; set; } = false;
}
}