diff options
author | maowtm <micromaomao@gmail.com> | 2021-01-16 00:10:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 19:10:24 -0500 |
commit | 71a2d687187b7cc9f7954cbc041e3dd34349d0aa (patch) | |
tree | 403cb03291116f7586f4dbfc198eb5978e75425f /src/transport.rs | |
parent | ce4e36a20c81b96eedff47cd76b5bdeaa8c99b28 (diff) |
Upgrade all dependencies (#246)
* Upgrade dependencies and add required features
* Special case for parsing unix:// url in Docker::new
hyper::Uri doesn't allow urls with empty authority, hence parsing
unix:///var/run/docker.sock will fail.
* Remove empty /lib.rs
* Fix cargo fmt
Diffstat (limited to 'src/transport.rs')
-rw-r--r-- | src/transport.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/transport.rs b/src/transport.rs index 3ad3b9e..b496e87 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -251,7 +251,7 @@ impl Transport { let response = self.send_request(req).await?; match response.status() { - StatusCode::SWITCHING_PROTOCOLS => Ok(response.into_body().on_upgrade().await?), + StatusCode::SWITCHING_PROTOCOLS => Ok(hyper::upgrade::on(response).await?), _ => Err(Error::ConnectionNotUpgraded), } } @@ -294,7 +294,12 @@ where cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<io::Result<usize>> { - self.project().tokio_multiplexer.poll_read(cx, buf) + let mut readbuf = tokio::io::ReadBuf::new(buf); + match self.project().tokio_multiplexer.poll_read(cx, &mut readbuf) { + Poll::Pending => Poll::Pending, + Poll::Ready(Ok(())) => Poll::Ready(Ok(readbuf.filled().len())), + Poll::Ready(Err(e)) => Poll::Ready(Err(e)), + } } } |