[snowpatch] [PATCH] hyper: Always follow redirects
Andrew Donnellan
andrew.donnellan at au1.ibm.com
Fri Feb 3 14:48:33 AEDT 2017
From: Russell Currey <ruscur at russell.cc>
Signed-off-by: Russell Currey <ruscur at russell.cc>
Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
---
Applied to master, for information only
There may be an issue here with potential to redirect over from HTTPS to
HTTP with sensitive credentials.
---
src/main.rs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 80be31d..d0e0b49 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -37,6 +37,7 @@ use hyper::Client;
use hyper::client::ProxyConfig;
use hyper::net::HttpsConnector;
use hyper_openssl::OpensslClient;
+use hyper::client::RedirectPolicy;
use docopt::Docopt;
@@ -276,11 +277,15 @@ fn main() {
proxy.host_str().unwrap().to_string(),
proxy.port().unwrap_or(80),
connector, ssl);
- Client::with_proxy_config(proxy_config)
+ let mut c = Client::with_proxy_config(proxy_config);
+ c.set_redirect_policy(RedirectPolicy::FollowAll);
+ c
},
_ => {
debug!("snowpatch starting without a HTTP proxy");
- Client::new()
+ let mut c = Client::new();
+ 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