http: fix proxy authorization header to include type

and encode the username:password string as base64 [0]. This fixes the
error 407 issue when using proxy authentication [1].

[0] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization
[1] https://forum.proxmox.com/threads/checking-the-subscription-behind-a-proxy-fails.112063/

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
This commit is contained in:
Mira Limbeck 2022-07-20 16:20:40 +02:00 committed by Wolfgang Bumiller
parent 760c49be6e
commit a8a838754d

View File

@ -184,8 +184,8 @@ impl hyper::service::Service<Uri> for HttpsConnector {
if let Some(authorization) = authorization {
let _ = write!(
connect_request,
"Proxy-Authorization: {}\r\n",
authorization
"Proxy-Authorization: Basic {}\r\n",
base64::encode(authorization)
);
}
let _ = write!(connect_request, "Host: {0}:{1}\r\n\r\n", host, port);