add Proxy::basic_auth support

Closes #322
This commit is contained in:
Sean McArthur
2019-01-04 13:48:11 -08:00
parent b9f4661332
commit ad854c3ee8
5 changed files with 289 additions and 25 deletions

View File

@@ -1,6 +1,13 @@
use std::fmt;
use header::HeaderMap;
use header::{
HeaderMap,
AUTHORIZATION,
COOKIE,
PROXY_AUTHORIZATION,
WWW_AUTHENTICATE,
};
use hyper::StatusCode;
use Url;
@@ -233,10 +240,11 @@ pub(crate) fn remove_sensitive_headers(headers: &mut HeaderMap, next: &Url, prev
let cross_host = next.host_str() != previous.host_str() ||
next.port_or_known_default() != previous.port_or_known_default();
if cross_host {
headers.remove("authorization");
headers.remove("cookie");
headers.remove(AUTHORIZATION);
headers.remove(COOKIE);
headers.remove("cookie2");
headers.remove("www-authenticate");
headers.remove(PROXY_AUTHORIZATION);
headers.remove(WWW_AUTHENTICATE);
}
}
}