hyper: use new hyper::upgrade
the old Body::on_upgrade method is no more Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
b5a202acb6
commit
89e9134a3f
@ -2,7 +2,7 @@ use anyhow::{bail, format_err, Error};
|
||||
use futures::*;
|
||||
use hyper::header::{HeaderValue, UPGRADE};
|
||||
use hyper::http::request::Parts;
|
||||
use hyper::{Body, Response, StatusCode};
|
||||
use hyper::{Body, Response, Request, StatusCode};
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use proxmox::{sortable, identity, list_subdirs_api_method};
|
||||
@ -171,8 +171,7 @@ async move {
|
||||
|
||||
let env2 = env.clone();
|
||||
|
||||
let mut req_fut = req_body
|
||||
.on_upgrade()
|
||||
let mut req_fut = hyper::upgrade::on(Request::from_parts(parts, req_body))
|
||||
.map_err(Error::from)
|
||||
.and_then(move |conn| {
|
||||
env2.debug("protocol upgrade done");
|
||||
|
@ -6,6 +6,7 @@ use futures::future::{FutureExt, TryFutureExt};
|
||||
use hyper::body::Body;
|
||||
use hyper::http::request::Parts;
|
||||
use hyper::upgrade::Upgraded;
|
||||
use hyper::Request;
|
||||
use serde_json::{json, Value};
|
||||
use tokio::io::{AsyncBufReadExt, BufReader};
|
||||
|
||||
@ -292,10 +293,10 @@ fn upgrade_to_websocket(
|
||||
Some(&ticket::term_aad(&userid, "/system", port)),
|
||||
)?;
|
||||
|
||||
let (ws, response) = WebSocket::new(parts.headers)?;
|
||||
let (ws, response) = WebSocket::new(parts.headers.clone())?;
|
||||
|
||||
crate::server::spawn_internal_task(async move {
|
||||
let conn: Upgraded = match req_body.on_upgrade().map_err(Error::from).await {
|
||||
let conn: Upgraded = match hyper::upgrade::on(Request::from_parts(parts, req_body)).map_err(Error::from).await {
|
||||
Ok(upgraded) => upgraded,
|
||||
_ => bail!("error"),
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ use anyhow::{bail, format_err, Error};
|
||||
use futures::*;
|
||||
use hyper::header::{self, HeaderValue, UPGRADE};
|
||||
use hyper::http::request::Parts;
|
||||
use hyper::{Body, Response, StatusCode};
|
||||
use hyper::{Body, Response, Request, StatusCode};
|
||||
use serde_json::Value;
|
||||
|
||||
use proxmox::{sortable, identity};
|
||||
@ -130,8 +130,7 @@ fn upgrade_to_backup_reader_protocol(
|
||||
|
||||
let abort_future = worker.abort_future();
|
||||
|
||||
let req_fut = req_body
|
||||
.on_upgrade()
|
||||
let req_fut = hyper::upgrade::on(Request::from_parts(parts, req_body))
|
||||
.map_err(Error::from)
|
||||
.and_then({
|
||||
let env = env.clone();
|
||||
|
@ -646,10 +646,7 @@ impl HttpClient {
|
||||
bail!("unknown error");
|
||||
}
|
||||
|
||||
let upgraded = resp
|
||||
.into_body()
|
||||
.on_upgrade()
|
||||
.await?;
|
||||
let upgraded = hyper::upgrade::on(resp).await?;
|
||||
|
||||
let max_window_size = (1 << 31) - 2;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user