src/client/http_client.rs: add flow control for h2 upload
This commit is contained in:
parent
97f22ce57d
commit
e3dbd41b20
|
@ -3,6 +3,8 @@
|
||||||
//! This library implements the client side to access the backups
|
//! This library implements the client side to access the backups
|
||||||
//! server using https.
|
//! server using https.
|
||||||
|
|
||||||
|
mod pipe_to_stream;
|
||||||
|
|
||||||
mod http_client;
|
mod http_client;
|
||||||
pub use http_client::*;
|
pub use http_client::*;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ use serde_json::{json, Value};
|
||||||
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
||||||
|
|
||||||
use crate::tools::{self, BroadcastFuture, tty};
|
use crate::tools::{self, BroadcastFuture, tty};
|
||||||
|
use super::pipe_to_stream::*;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct AuthInfo {
|
struct AuthInfo {
|
||||||
|
@ -414,13 +415,14 @@ impl H2Client {
|
||||||
.ready()
|
.ready()
|
||||||
.map_err(Error::from)
|
.map_err(Error::from)
|
||||||
.and_then(move |mut send_request| {
|
.and_then(move |mut send_request| {
|
||||||
let (response, mut stream) = send_request.send_request(request, false).unwrap();
|
let (response, stream) = send_request.send_request(request, false).unwrap();
|
||||||
// fixme: implement flow control
|
PipeToSendStream::new(bytes::Bytes::from(data), stream)
|
||||||
stream.send_data(bytes::Bytes::from(data), true);
|
.and_then(|_| {
|
||||||
response
|
response
|
||||||
.map_err(Error::from)
|
.map_err(Error::from)
|
||||||
.and_then(Self::h2api_response)
|
.and_then(Self::h2api_response)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn request(
|
fn request(
|
||||||
|
|
Loading…
Reference in New Issue