main: Use SSL connector for non-proxied connections
diff mbox

Message ID 20170523055333.12435-1-andrew.donnellan@au1.ibm.com
State Accepted
Delegated to: Russell Currey
Headers show

Commit Message

Andrew Donnellan May 23, 2017, 5:53 a.m. UTC
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@au1.ibm.com>
---
 src/main.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox

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
         }