mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-03 12:01:08 +00:00
uri: drop anyhow::Error and improve docs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
ca9dd7ec36
commit
c9b4a4f39b
@ -135,7 +135,7 @@ impl hyper::service::Service<Uri> for HttpsConnector {
|
|||||||
|
|
||||||
let proxy_authority = match build_authority(&proxy.host, proxy.port) {
|
let proxy_authority = match build_authority(&proxy.host, proxy.port) {
|
||||||
Ok(authority) => authority,
|
Ok(authority) => authority,
|
||||||
Err(err) => return futures::future::err(err).boxed(),
|
Err(err) => return futures::future::err(err.into()).boxed(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let proxy_uri = match Uri::builder()
|
let proxy_uri = match Uri::builder()
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
use anyhow::Error;
|
//! URI Related helpers, such as `build_authority`
|
||||||
|
|
||||||
use http::uri::Authority;
|
use http::uri::{Authority, InvalidUri};
|
||||||
|
|
||||||
// Build a http::uri::Authority ("host:port"), use '[..]' around IPv6 addresses
|
// Build an [`Authority`](http::uri::Authority) from a combination of `host` and `port`, ensuring that
|
||||||
pub fn build_authority(host: &str, port: u16) -> Result<Authority, Error> {
|
// IPv6 addresses are enclosed in brackets.
|
||||||
|
pub fn build_authority(host: &str, port: u16) -> Result<Authority, InvalidUri> {
|
||||||
let bytes = host.as_bytes();
|
let bytes = host.as_bytes();
|
||||||
let len = bytes.len();
|
let len = bytes.len();
|
||||||
let authority =
|
let authority =
|
||||||
|
Loading…
Reference in New Issue
Block a user