mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-02 12:33:30 +00:00
update proxmox-http to 0.5 for the split
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
336dab0177
commit
4ccd6256a8
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "proxmox-http"
|
||||
edition = "2018"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
authors = [
|
||||
"Dietmar Maurer <dietmar@proxmox.com>",
|
||||
"Wolfgang Bumiller <w.bumiller@proxmox.com>",
|
||||
@ -21,11 +21,20 @@ openssl = { version = "0.10", optional = true }
|
||||
tokio = { version = "1.0", features = [], optional = true }
|
||||
tokio-openssl = { version = "0.6.1", optional = true }
|
||||
|
||||
proxmox = { path = "../proxmox", optional = true, version = "0.13.0", default-features = false }
|
||||
proxmox = { path = "../proxmox", optional = true, version = "0.14.0", default-features = false }
|
||||
proxmox-io = { path = "../proxmox-io", optional = true, version = "1.0.0" }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
client = [ "futures", "http-helpers", "openssl" ]
|
||||
http-helpers = [ "base64", "http", "hyper", "tokio/io-util", "tokio-openssl", "proxmox" ]
|
||||
websocket = [ "base64", "futures", "hyper", "openssl", "proxmox/tokio", "tokio/io-util", "tokio/sync" ]
|
||||
websocket = [
|
||||
"base64",
|
||||
"futures",
|
||||
"hyper",
|
||||
"openssl",
|
||||
"proxmox-io/tokio",
|
||||
"tokio/io-util",
|
||||
"tokio/sync",
|
||||
]
|
||||
|
@ -1,3 +1,9 @@
|
||||
rust-proxmox-http (0.5.0-1) stable; urgency=medium
|
||||
|
||||
* update to proxmox 0.14.0
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 08 Oct 2021 08:50:27 +0200
|
||||
|
||||
rust-proxmox-http (0.4.0-1) stable; urgency=medium
|
||||
|
||||
* update proxmox to 0.13.0
|
||||
|
@ -28,6 +28,7 @@ Suggests:
|
||||
librust-proxmox-http+hyper-dev (= ${binary:Version}),
|
||||
librust-proxmox-http+openssl-dev (= ${binary:Version}),
|
||||
librust-proxmox-http+proxmox-dev (= ${binary:Version}),
|
||||
librust-proxmox-http+proxmox-io-dev (= ${binary:Version}),
|
||||
librust-proxmox-http+tokio-dev (= ${binary:Version}),
|
||||
librust-proxmox-http+tokio-openssl-dev (= ${binary:Version}),
|
||||
librust-proxmox-http+websocket-dev (= ${binary:Version})
|
||||
@ -35,10 +36,10 @@ Provides:
|
||||
librust-proxmox-http+default-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0+default-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+default-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+default-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5+default-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+default-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - Rust source code
|
||||
This package contains the source for the Rust proxmox-http crate, packaged by
|
||||
debcargo for use with cargo and dh-cargo.
|
||||
@ -52,8 +53,8 @@ Depends:
|
||||
librust-base64-0.12+default-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+base64-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+base64-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+base64-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+base64-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+base64-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "base64"
|
||||
This metapackage enables feature "base64" for the Rust proxmox-http crate, by
|
||||
pulling in any additional dependencies needed by that feature.
|
||||
@ -69,8 +70,8 @@ Depends:
|
||||
librust-openssl-0.10+default-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+client-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+client-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+client-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+client-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+client-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "client"
|
||||
This metapackage enables feature "client" for the Rust proxmox-http crate, by
|
||||
pulling in any additional dependencies needed by that feature.
|
||||
@ -84,8 +85,8 @@ Depends:
|
||||
librust-futures-0.3+default-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+futures-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+futures-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+futures-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+futures-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+futures-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "futures"
|
||||
This metapackage enables feature "futures" for the Rust proxmox-http crate, by
|
||||
pulling in any additional dependencies needed by that feature.
|
||||
@ -99,8 +100,8 @@ Depends:
|
||||
librust-http-0.2+default-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+http-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+http-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+http-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+http-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+http-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "http"
|
||||
This metapackage enables feature "http" for the Rust proxmox-http crate, by
|
||||
pulling in any additional dependencies needed by that feature.
|
||||
@ -115,13 +116,13 @@ Depends:
|
||||
librust-http-0.2+default-dev,
|
||||
librust-hyper-0.14+default-dev,
|
||||
librust-hyper-0.14+full-dev,
|
||||
librust-proxmox-0.13-dev,
|
||||
librust-proxmox-0.14-dev,
|
||||
librust-tokio-1+io-util-dev,
|
||||
librust-tokio-openssl-0.6+default-dev (>= 0.6.1-~~)
|
||||
Provides:
|
||||
librust-proxmox-http-0+http-helpers-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+http-helpers-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+http-helpers-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+http-helpers-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+http-helpers-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "http-helpers"
|
||||
This metapackage enables feature "http-helpers" for the Rust proxmox-http
|
||||
crate, by pulling in any additional dependencies needed by that feature.
|
||||
@ -136,8 +137,8 @@ Depends:
|
||||
librust-hyper-0.14+full-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+hyper-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+hyper-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+hyper-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+hyper-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+hyper-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "hyper"
|
||||
This metapackage enables feature "hyper" for the Rust proxmox-http crate, by
|
||||
pulling in any additional dependencies needed by that feature.
|
||||
@ -151,8 +152,8 @@ Depends:
|
||||
librust-openssl-0.10+default-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+openssl-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+openssl-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+openssl-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+openssl-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+openssl-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "openssl"
|
||||
This metapackage enables feature "openssl" for the Rust proxmox-http crate, by
|
||||
pulling in any additional dependencies needed by that feature.
|
||||
@ -163,15 +164,30 @@ Multi-Arch: same
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
librust-proxmox-http-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.13-dev
|
||||
librust-proxmox-0.14-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+proxmox-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+proxmox-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+proxmox-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+proxmox-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+proxmox-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "proxmox"
|
||||
This metapackage enables feature "proxmox" for the Rust proxmox-http crate, by
|
||||
pulling in any additional dependencies needed by that feature.
|
||||
|
||||
Package: librust-proxmox-http+proxmox-io-dev
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
librust-proxmox-http-dev (= ${binary:Version}),
|
||||
librust-proxmox-io-1+default-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+proxmox-io-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5+proxmox-io-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+proxmox-io-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "proxmox-io"
|
||||
This metapackage enables feature "proxmox-io" for the Rust proxmox-http crate,
|
||||
by pulling in any additional dependencies needed by that feature.
|
||||
|
||||
Package: librust-proxmox-http+tokio-dev
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
@ -181,8 +197,8 @@ Depends:
|
||||
librust-tokio-1+default-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+tokio-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+tokio-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+tokio-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+tokio-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+tokio-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "tokio"
|
||||
This metapackage enables feature "tokio" for the Rust proxmox-http crate, by
|
||||
pulling in any additional dependencies needed by that feature.
|
||||
@ -196,8 +212,8 @@ Depends:
|
||||
librust-tokio-openssl-0.6+default-dev (>= 0.6.1-~~)
|
||||
Provides:
|
||||
librust-proxmox-http-0+tokio-openssl-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+tokio-openssl-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+tokio-openssl-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+tokio-openssl-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+tokio-openssl-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "tokio-openssl"
|
||||
This metapackage enables feature "tokio-openssl" for the Rust proxmox-http
|
||||
crate, by pulling in any additional dependencies needed by that feature.
|
||||
@ -213,13 +229,13 @@ Depends:
|
||||
librust-hyper-0.14+default-dev,
|
||||
librust-hyper-0.14+full-dev,
|
||||
librust-openssl-0.10+default-dev,
|
||||
librust-proxmox-0.13+tokio-dev,
|
||||
librust-proxmox-io-1+tokio-dev,
|
||||
librust-tokio-1+io-util-dev,
|
||||
librust-tokio-1+sync-dev
|
||||
Provides:
|
||||
librust-proxmox-http-0+websocket-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4+websocket-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.4.0+websocket-dev (= ${binary:Version})
|
||||
librust-proxmox-http-0.5+websocket-dev (= ${binary:Version}),
|
||||
librust-proxmox-http-0.5.0+websocket-dev (= ${binary:Version})
|
||||
Description: Proxmox HTTP library - feature "websocket"
|
||||
This metapackage enables feature "websocket" for the Rust proxmox-http crate,
|
||||
by pulling in any additional dependencies needed by that feature.
|
||||
|
@ -3,15 +3,15 @@
|
||||
#[cfg(feature = "websocket")]
|
||||
pub mod websocket;
|
||||
|
||||
#[cfg(any(feature = "http-helpers"))]
|
||||
#[cfg(feature = "http-helpers")]
|
||||
pub mod tls;
|
||||
|
||||
#[cfg(any(feature = "http-helpers"))]
|
||||
#[cfg(feature = "http-helpers")]
|
||||
pub mod uri;
|
||||
|
||||
#[cfg(any(feature = "http-helpers"))]
|
||||
#[cfg(feature = "http-helpers")]
|
||||
pub mod proxy_config;
|
||||
#[cfg(any(feature = "http-helpers"))]
|
||||
#[cfg(feature = "http-helpers")]
|
||||
pub use proxy_config::ProxyConfig;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
|
@ -42,39 +42,41 @@ impl ProxyConfig {
|
||||
///
|
||||
/// Default port is 1080 (like curl)
|
||||
pub fn parse_proxy_url(http_proxy: &str) -> Result<ProxyConfig, Error> {
|
||||
proxmox::try_block!({
|
||||
let proxy_uri: Uri = http_proxy.parse()?;
|
||||
let proxy_authority = match proxy_uri.authority() {
|
||||
Some(authority) => authority,
|
||||
None => bail!("missing proxy authority"),
|
||||
};
|
||||
let host = proxy_authority.host().to_owned();
|
||||
let port = match proxy_uri.port() {
|
||||
Some(port) => port.as_u16(),
|
||||
None => 1080, // CURL default port
|
||||
};
|
||||
Self::parse_proxy_url_do(http_proxy)
|
||||
.map_err(|err| format_err!("parse_proxy_url failed: {}", err))
|
||||
}
|
||||
|
||||
match proxy_uri.scheme_str() {
|
||||
Some("http") => { /* Ok */ }
|
||||
Some(scheme) => bail!("unsupported proxy scheme '{}'", scheme),
|
||||
None => { /* assume HTTP */ }
|
||||
}
|
||||
fn parse_proxy_url_do(http_proxy: &str) -> Result<ProxyConfig, Error> {
|
||||
let proxy_uri: Uri = http_proxy.parse()?;
|
||||
let proxy_authority = match proxy_uri.authority() {
|
||||
Some(authority) => authority,
|
||||
None => bail!("missing proxy authority"),
|
||||
};
|
||||
let host = proxy_authority.host().to_owned();
|
||||
let port = match proxy_uri.port() {
|
||||
Some(port) => port.as_u16(),
|
||||
None => 1080, // CURL default port
|
||||
};
|
||||
|
||||
let authority_vec: Vec<&str> = proxy_authority.as_str().rsplitn(2, '@').collect();
|
||||
let authorization = if authority_vec.len() == 2 {
|
||||
Some(authority_vec[1].to_string())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
match proxy_uri.scheme_str() {
|
||||
Some("http") => { /* Ok */ }
|
||||
Some(scheme) => bail!("unsupported proxy scheme '{}'", scheme),
|
||||
None => { /* assume HTTP */ }
|
||||
}
|
||||
|
||||
Ok(ProxyConfig {
|
||||
host,
|
||||
port,
|
||||
authorization,
|
||||
force_connect: false,
|
||||
})
|
||||
let authority_vec: Vec<&str> = proxy_authority.as_str().rsplitn(2, '@').collect();
|
||||
let authorization = if authority_vec.len() == 2 {
|
||||
Some(authority_vec[1].to_string())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Ok(ProxyConfig {
|
||||
host,
|
||||
port,
|
||||
authorization,
|
||||
force_connect: false,
|
||||
})
|
||||
.map_err(|err| format_err!("parse_proxy_url failed: {}", err))
|
||||
}
|
||||
|
||||
/// Assemble canonical proxy string (including scheme and port)
|
||||
|
@ -23,7 +23,7 @@ use futures::future::FutureExt;
|
||||
use futures::ready;
|
||||
|
||||
use proxmox::sys::error::io_err_other;
|
||||
use proxmox::tools::byte_buffer::ByteBuffer;
|
||||
use proxmox_io::ByteBuffer;
|
||||
|
||||
// see RFC6455 section 7.4.1
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
Loading…
Reference in New Issue
Block a user