[snowpatch] [PATCH] main: Use SSL connector for non-proxied connections

Andrew Donnellan andrew.donnellan at au1.ibm.com
Tue May 23 15:53:33 AEST 2017


We currently create an HttpsConnector so we can use HTTPS with hyper, but
we only actually use it in the case where an HTTP proxy is used.

Fix the non-proxy case so the hyper client uses the HttpsConnector.

Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
---
 src/main.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index a0e6576..9b24385 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -263,9 +263,9 @@ fn main() {
     let settings = settings::parse(&args.arg_config_file);
 
     // The HTTP client we'll use to access the APIs
-    // TODO: HTTPS support, not yet implemented in Hyper as of 0.9.6
     let ssl = OpensslClient::new().unwrap();
     let connector = HttpsConnector::new(ssl.clone());
+    // TODO: Handle https_proxy
     let client = Arc::new(match env::var("http_proxy") {
         Ok(proxy_url) => {
             debug!("snowpatch is using HTTP proxy {}", proxy_url);
@@ -286,7 +286,7 @@ fn main() {
         },
         _ => {
             debug!("snowpatch starting without a HTTP proxy");
-            let mut c = Client::new();
+            let mut c = Client::with_connector(connector);
             c.set_redirect_policy(RedirectPolicy::FollowAll);
             c
         }
-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the snowpatch mailing list