1
0
Fork 0

Change host url to https when it's enabled, should fix some problems downloading attachments

Dieser Commit ist enthalten in:
Daniel García 2018-07-11 16:23:39 +02:00
Ursprung ec37004dfe
Commit e88d8c856d

Datei anzeigen

@ -111,7 +111,11 @@ impl<'a, 'r> FromRequest<'a, 'r> for Headers {
// Get host
let host = match headers.get_one("Host") {
Some(host) => format!("http://{}", host), // TODO: Check if HTTPS
Some(host) => {
use std::env;
let protocol = if env::var("ROCKET_TLS").is_ok() {"https"} else {"http"};
format!("{}://{}", protocol, host)
},
_ => String::new()
};