예제 #1
0
        public ProxyTransport(TestProxy proxy, HttpPipelineTransport transport, TestRecording recording, Func <EntryRecordModel> filter)
        {
            _recording = recording;
            _proxy     = proxy;
            _filter    = filter;

            bool   useFiddler = TestEnvironment.EnableFiddler;
            string certIssuer = useFiddler ? FiddlerCertIssuer : DevCertIssuer;

            _proxyHost = useFiddler ? "ipv4.fiddler" : TestProxy.IpAddress;

            if (transport is HttpClientTransport)
            {
                var handler = new HttpClientHandler
                {
                    ServerCertificateCustomValidationCallback = (_, certificate, _, _) => certificate.Issuer == certIssuer
                };
                _innerTransport = new HttpClientTransport(handler);
            }
            // HttpWebRequestTransport
            else
            {
                _isWebRequestTransport = true;
                _innerTransport        = transport;
                _serverCertificateCustomValidationCallback = (_, certificate, _, _) => certificate.Issuer == certIssuer;
            }
        }
예제 #2
0
        public ProxyTransport(TestProxy proxy, HttpPipelineTransport transport, TestRecording recording, Func <EntryRecordModel> filter)
        {
            _recording = recording;
            _proxy     = proxy;
            _filter    = filter;

            bool   useFiddler = TestEnvironment.EnableFiddler;
            string certIssuer = useFiddler ? FiddlerCertIssuer : DevCertIssuer;

            _proxyHost = useFiddler ? "ipv4.fiddler" : TestProxy.IpAddress;

            if (transport is HttpClientTransport)
            {
                var handler = new HttpClientHandler
                {
                    ServerCertificateCustomValidationCallback = (_, certificate, _, _) => certificate.Issuer == certIssuer,
                    // copied from HttpClientTransport - not needed for HttpWebRequestTransport case as cookies are already off by default and can't be turned on
                    UseCookies = AppContextSwitchHelper.GetConfigValue(
                        "Azure.Core.Pipeline.HttpClientTransport.EnableCookies",
                        "AZURE_CORE_HTTPCLIENT_ENABLE_COOKIES")
                };
                _innerTransport = new HttpClientTransport(handler);
            }
            // HttpWebRequestTransport
            else
            {
                _isWebRequestTransport = true;
                _innerTransport        = transport;
                _serverCertificateCustomValidationCallback = (_, certificate, _, _) => certificate.Issuer == certIssuer;
            }
        }
예제 #3
0
 public ProxyTransport(TestProxy proxy, HttpPipelineTransport transport, TestRecording recording, Func <EntryRecordModel> filter)
 {
     if (transport is HttpClientTransport)
     {
         var handler = new HttpClientHandler
         {
             ServerCertificateCustomValidationCallback = (_, certificate, _, _) => certificate.Issuer == TestProxy.DevCertIssuer
         };
         _innerTransport = new HttpClientTransport(handler);
     }
     // HttpWebRequestTransport
     else
     {
         _isWebRequestTransport = true;
         _innerTransport        = transport;
     }
     _recording = recording;
     _proxy     = proxy;
     _filter    = filter;
 }