File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ public static void InitializeVssClientSettings(List<ProductInfoHeaderValue> addi
3838 if ( StringUtil . ConvertToBoolean ( Environment . GetEnvironmentVariable ( "GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY" ) ) )
3939 {
4040 VssClientHttpRequestSettings . Default . ServerCertificateValidationCallback = HttpClientHandler . DangerousAcceptAnyServerCertificateValidator ;
41+ RawClientHttpRequestSettings . Default . ServerCertificateValidationCallback = HttpClientHandler . DangerousAcceptAnyServerCertificateValidator ;
4142 }
4243
4344 var rawHeaderValues = new List < ProductInfoHeaderValue > ( ) ;
Original file line number Diff line number Diff line change @@ -106,6 +106,18 @@ protected override async Task<HttpResponseMessage> SendAsync(
106106 {
107107 VssTraceActivity traceActivity = VssTraceActivity . Current ;
108108
109+ if ( ! m_appliedServerCertificateValidationCallbackToTransportHandler &&
110+ request . RequestUri . Scheme == "https" )
111+ {
112+ HttpClientHandler httpClientHandler = m_transportHandler as HttpClientHandler ;
113+ if ( httpClientHandler != null &&
114+ this . Settings . ServerCertificateValidationCallback != null )
115+ {
116+ httpClientHandler . ServerCertificateCustomValidationCallback = this . Settings . ServerCertificateValidationCallback ;
117+ }
118+ m_appliedServerCertificateValidationCallbackToTransportHandler = true ;
119+ }
120+
109121 lock ( m_thisLock )
110122 {
111123 // Ensure that we attempt to use the most appropriate authentication mechanism by default.
@@ -291,6 +303,7 @@ private static void ApplySettings(
291303 }
292304 }
293305
306+ private bool m_appliedServerCertificateValidationCallbackToTransportHandler ;
294307 private readonly HttpMessageHandler m_transportHandler ;
295308 private HttpMessageInvoker m_messageInvoker ;
296309 private CredentialWrapper m_credentialWrapper ;
You can’t perform that action at this time.
0 commit comments