diff options
| author | Zeyla Hellyer <[email protected]> | 2017-06-09 15:10:13 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-06-09 15:10:13 -0700 |
| commit | 3c2b12e09eacc0b8c7ddc5808ddbcd10a55210e0 (patch) | |
| tree | 12b823949d2a1c3bc5f55a34ff3d78d2f90ce8a1 /src/http | |
| parent | Remove unused cookie dependency (diff) | |
| download | serenity-3c2b12e09eacc0b8c7ddc5808ddbcd10a55210e0.tar.xz serenity-3c2b12e09eacc0b8c7ddc5808ddbcd10a55210e0.zip | |
Use an https connector in http::send_files
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs index 7a3b729..2b69831 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -38,7 +38,9 @@ use hyper::client::{ Request, }; use hyper::method::Method; +use hyper::net::HttpsConnector; use hyper::{Error as HyperError, Result as HyperResult, Url, header}; +use hyper_native_tls::NativeTlsClient; use multipart::client::Multipart; use self::ratelimiting::Route; use serde_json; @@ -1436,7 +1438,9 @@ pub fn send_files<'a, T>(channel_id: u64, files: Vec<T>, map: JsonMap) Err(_) => return Err(Error::Url(uri)), }; - let mut request = Request::new(Method::Post, url)?; + let tc = NativeTlsClient::new()?; + let connector = HttpsConnector::new(tc); + let mut request = Request::with_connector(Method::Post, url, &connector)?; request.headers_mut() .set(header::Authorization(TOKEN.lock().unwrap().clone())); request.headers_mut() |