public override HttpClient CreateHttpClient(IClientConfig clientConfig) { if (!_useSDKHttpClientCaching && !_disposeHttpClientsAfterUse) { // assume we're doing the caching lock (_cacheLock) { if (ClientCache == null) { var clients = new HttpClient[clientConfig.HttpClientCacheSize]; for (int i = 0; i < clientConfig.HttpClientCacheSize; i++) { clients[i] = new MyHttpClient(i); } ClientCache = new HttpClientCache(clients); } } return(ClientCache.GetNextClient()); } else { // there is no caching or at least we're not doing it here UncachedClients.Add(new MyHttpClient(UncachedClients.Count)); return(UncachedClients[UncachedClients.Count - 1]); } }
/// <summary> /// default ctor /// </summary> /// <param name="maxNumberOfCachedRequests"></param> public HttpJsonRequestFactory(int maxNumberOfCachedRequests, HttpMessageHandler httpMessageHandler = null) { this.maxNumberOfCachedRequests = maxNumberOfCachedRequests; this.httpMessageHandler = httpMessageHandler; httpClientCache = new HttpClientCache(); ResetCache(); }
/// <summary> /// default ctor /// </summary> /// <param name="maxNumberOfCachedRequests"></param> public HttpJsonRequestFactory(int maxNumberOfCachedRequests, Func <HttpMessageHandler> httpMessageHandler = null, bool acceptGzipContent = true) { this.maxNumberOfCachedRequests = maxNumberOfCachedRequests; this.httpMessageHandler = httpMessageHandler; this.acceptGzipContent = acceptGzipContent; httpClientCache = new HttpClientCache(ServicePointManager.MaxServicePointIdleTime); ResetCache(); }
/// <summary> /// default ctor /// </summary> /// <param name="maxNumberOfCachedRequests"></param> public HttpJsonRequestFactory(int maxNumberOfCachedRequests, HttpMessageHandler httpMessageHandler = null, bool acceptGzipContent = true) { this.maxNumberOfCachedRequests = maxNumberOfCachedRequests; this.httpMessageHandler = httpMessageHandler; this.acceptGzipContent = acceptGzipContent; httpClientCache = new HttpClientCache(); ResetCache(); }
public Task <ISendTransport> GetSendTransport(Uri address) { if (!_busConfiguration.TryGetHost(address, out var hostConfiguration)) { throw new EndpointNotFoundException($"The host was not found for the specified address: {address}"); } var clientCache = new HttpClientCache(_receivePipe); var sendSettings = address.GetSendSettings(); return(Task.FromResult <ISendTransport>(new HttpSendTransport(clientCache, sendSettings, _receiveObserver, _topology))); }
/// <summary> /// default ctor /// </summary> /// <param name="maxNumberOfCachedRequests"></param> /// <param name="httpMessageHandler"></param> /// <param name="acceptGzipContent"></param> /// <param name="authenticationScheme"></param> public HttpJsonRequestFactory(int maxNumberOfCachedRequests, Func <HttpMessageHandler> httpMessageHandler = null, bool acceptGzipContent = true, string authenticationScheme = null) { this.maxNumberOfCachedRequests = maxNumberOfCachedRequests; this.httpMessageHandler = httpMessageHandler; this.acceptGzipContent = acceptGzipContent; this.authenticationScheme = authenticationScheme; var maxIdleTime = 100 * 1000;//this matches ServicePointManager.MaxServicePointIdleTime httpClientCache = new HttpClientCache(maxIdleTime); ResetCache(); }
internal CyberArkSecureStoreCCP(IHttpClientFactory httpClientFactory, X509CertificateManager x509CertificateManager) { _httpClientCache = new HttpClientCache(httpClientFactory, x509CertificateManager); }
public CyberArkSecureStoreCCP() { var x509CertificateManager = new X509CertificateManager(); _httpClientCache = new HttpClientCache(new HttpClientFactory(x509CertificateManager), x509CertificateManager); }