コード例 #1
0
        private HttpClient CreateHttpClient()
        {
#pragma warning disable CA2000 // Dispose objects before losing scope
            // Will be handled once we migrate to DI.
            // https://github.com/Azure/iotedge-lorawan-starterkit/issues/534
            var handler = new ServiceFacadeHttpClientHandler(this.expectedFunctionVersion);
#pragma warning restore CA2000 // Dispose objects before losing scope

            if (!string.IsNullOrEmpty(this.configuration.HttpsProxy))
            {
                var webProxy = new WebProxy(
                    new Uri(this.configuration.HttpsProxy),
                    BypassOnLocal: false);

                handler.Proxy    = webProxy;
                handler.UseProxy = true;
            }

#pragma warning disable CA5399 // Definitely disable HttpClient certificate revocation list check
            // Related to: https://github.com/Azure/iotedge-lorawan-starterkit/issues/534
            // Will be resolved once we migrate to DI
            return(new HttpClient(handler));

#pragma warning restore CA5399 // Definitely disable HttpClient certificate revocation list check
        }
コード例 #2
0
        HttpClient CreateHttpClient()
        {
            var handler = new ServiceFacadeHttpClientHandler(this.expectedFunctionVersion);

            if (!string.IsNullOrEmpty(this.configuration.HttpsProxy))
            {
                var webProxy = new WebProxy(
                    new Uri(this.configuration.HttpsProxy),
                    BypassOnLocal: false);

                handler.Proxy    = webProxy;
                handler.UseProxy = true;
            }

            return(new HttpClient(handler));
        }