public override HttpWebRequest GetWebRequest(EndpointAddress to, Uri via, ref TimeoutHelper timeoutHelper) { SecurityTokenContainer clientCertificateToken = this.Factory.GetCertificateSecurityToken(this.certificateProvider, to, via, base.ChannelParameters, ref timeoutHelper); HttpWebRequest request = base.GetWebRequest(to, via, clientCertificateToken, ref timeoutHelper); HttpTransportSecurityHelpers.AddServerCertMapping(request, to); return(request); }
void AddServerCertMappingOrSetRemoteCertificateValidationCallback(HttpWebRequest request, EndpointAddress to) { Fx.Assert(request != null, "request should not be null."); if (this.sslCertificateValidator != null) { request.ServerCertificateValidationCallback = this.remoteCertificateValidationCallback; } else { HttpTransportSecurityHelpers.AddServerCertMapping(request, to); } }
private bool GetWebRequest() { IAsyncResult result = this.httpsChannel.BeginBaseGetWebRequest(this.to, this.via, this.tokenContainer, ref this.timeoutHelper, onGetBaseWebRequestCallback, this); if (!result.CompletedSynchronously) { return(false); } this.request = this.httpsChannel.EndBaseGetWebRequest(result); HttpTransportSecurityHelpers.AddServerCertMapping(this.request, this.to); return(true); }
private static void OnGetBaseWebRequestCallback(IAsyncResult result) { if (!result.CompletedSynchronously) { HttpsChannelFactory.HttpsRequestChannel.GetWebRequestAsyncResult asyncState = (HttpsChannelFactory.HttpsRequestChannel.GetWebRequestAsyncResult)result.AsyncState; Exception exception = null; try { asyncState.request = asyncState.httpsChannel.EndBaseGetWebRequest(result); HttpTransportSecurityHelpers.AddServerCertMapping(asyncState.request, asyncState.to); } catch (Exception exception2) { if (Fx.IsFatal(exception2)) { throw; } exception = exception2; } asyncState.Complete(false, exception); } }