Helper class that reads the proxy settings from environment variable http_proxy or HTTP_PROXY and provides the information for the Amazon S3Client.
Ejemplo n.º 1
0
        public void LowercaseEnvironmentVariable()
        {
            Environment.SetEnvironmentVariable("http_proxy", "http://example.com");

            var proxy = new ProxyManager();

            Assert.That(proxy.Hostname, Is.EqualTo("example.com"));
            Assert.That(proxy.Port, Is.EqualTo(80));
            Assert.That(proxy.Username, Is.Null);
            Assert.That(proxy.Password, Is.Null);
        }
Ejemplo n.º 2
0
 public BloomS3Client(string bucketName)
 {
     _bucketName = bucketName;
     _s3Config = new AmazonS3Config { ServiceURL = "https://s3.amazonaws.com" };
     var proxy = new ProxyManager();
     if (!string.IsNullOrEmpty(proxy.Hostname))
     {
         _s3Config.ProxyHost = proxy.Hostname;
         _s3Config.ProxyPort = proxy.Port;
         if (!string.IsNullOrEmpty(proxy.Username))
             _s3Config.ProxyCredentials = new NetworkCredential(proxy.Username, proxy.Password);
     }
 }
Ejemplo n.º 3
0
        public BloomS3Client(string bucketName)
        {
            _bucketName = bucketName;
            _s3Config   = new AmazonS3Config {
                ServiceURL = "https://s3.amazonaws.com"
            };
            var proxy = new ProxyManager();

            if (!string.IsNullOrEmpty(proxy.Hostname))
            {
                _s3Config.ProxyHost = proxy.Hostname;
                _s3Config.ProxyPort = proxy.Port;
                if (!string.IsNullOrEmpty(proxy.Username))
                {
                    _s3Config.ProxyCredentials = new NetworkCredential(proxy.Username, proxy.Password);
                }
            }
        }