Skip to content

Commit 58e3935

Browse files
committed
update
1 parent 2a5f805 commit 58e3935

10 files changed

Lines changed: 19 additions & 18 deletions

File tree

src/client/response.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ impl Response {
421421

422422
/// Consumes the response and returns a future for a possible HTTP upgrade.
423423
pub async fn upgrade(self) -> crate::Result<Upgraded> {
424-
crate::core::upgrade::on(self.res)
424+
crate::core::client::upgrade::on(self.res)
425425
.await
426426
.map(Upgraded::from)
427427
.map_err(Error::upgrade)

src/client/upgrade.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use std::{
66

77
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
88

9-
use crate::core::rt::TokioIo;
9+
use crate::core::{client::upgrade, rt::TokioIo};
1010

1111
/// An upgraded HTTP connection.
1212
pub struct Upgraded {
13-
inner: TokioIo<crate::core::upgrade::Upgraded>,
13+
inner: TokioIo<upgrade::Upgraded>,
1414
}
1515

1616
impl AsyncRead for Upgraded {
@@ -59,8 +59,8 @@ impl fmt::Debug for Upgraded {
5959
}
6060
}
6161

62-
impl From<crate::core::upgrade::Upgraded> for Upgraded {
63-
fn from(inner: crate::core::upgrade::Upgraded) -> Self {
62+
impl From<upgrade::Upgraded> for Upgraded {
63+
fn from(inner: upgrade::Upgraded) -> Self {
6464
Upgraded {
6565
inner: TokioIo::new(inner),
6666
}

src/core/client/conn/http1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl Builder {
296296

297297
mod upgrades {
298298
use super::*;
299-
use crate::core::upgrade::Upgraded;
299+
use crate::core::client::upgrade::Upgraded;
300300

301301
// A future binding a connection with a Service with Upgrade support.
302302
//

src/core/client/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ mod service;
1010
pub mod conn;
1111
pub mod connect;
1212
pub mod options;
13+
pub mod upgrade;
1314

1415
pub use self::body::Incoming;
1516
pub(crate) use self::service::meta::{ConnectMeta, Identifier};

src/core/client/proto/h1/conn.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::core::{
2121
client::{
2222
body::DecodedLength,
2323
proto::{BodyLength, MessageHead, headers},
24+
upgrade,
2425
},
2526
rt::{Read, Write},
2627
};
@@ -108,7 +109,7 @@ where
108109
self.io.into_inner()
109110
}
110111

111-
pub(crate) fn pending_upgrade(&mut self) -> Option<crate::core::upgrade::Pending> {
112+
pub(crate) fn pending_upgrade(&mut self) -> Option<upgrade::Pending> {
112113
self.state.upgrade.take()
113114
}
114115

@@ -763,7 +764,7 @@ where
763764
}
764765
}
765766

766-
pub(super) fn on_upgrade(&mut self) -> crate::core::upgrade::OnUpgrade {
767+
pub(super) fn on_upgrade(&mut self) -> upgrade::OnUpgrade {
767768
trace!("{}: prepare possible HTTP upgrade", T::LOG);
768769
self.state.prepare_upgrade()
769770
}
@@ -807,7 +808,7 @@ struct State {
807808
/// State of allowed writes
808809
writing: Writing,
809810
/// An expected pending HTTP upgrade.
810-
upgrade: Option<crate::core::upgrade::Pending>,
811+
upgrade: Option<upgrade::Pending>,
811812
/// Either HTTP/1.0 or 1.1 connection
812813
version: Version,
813814
/// Flag to track if trailer fields are allowed to be sent
@@ -991,8 +992,8 @@ impl State {
991992
matches!(self.writing, Writing::Closed)
992993
}
993994

994-
fn prepare_upgrade(&mut self) -> crate::core::upgrade::OnUpgrade {
995-
let (tx, rx) = crate::core::upgrade::pending();
995+
fn prepare_upgrade(&mut self) -> upgrade::OnUpgrade {
996+
let (tx, rx) = upgrade::pending();
996997
self.upgrade = Some(tx);
997998
rx
998999
}

src/core/client/proto/h1/dispatch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use crate::core::{
1616
body::{self, DecodedLength, Incoming as IncomingBody},
1717
dispatch::{self, TrySendError},
1818
proto::{self, BodyLength, Conn, Dispatched, MessageHead, RequestHead},
19+
upgrade::OnUpgrade,
1920
},
2021
error::BoxError,
2122
rt::{Read, Write},
22-
upgrade::OnUpgrade,
2323
};
2424

2525
pub(crate) struct Dispatcher<D, Bs: Body, I, T> {

src/core/client/proto/h2/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ use crate::core::{
3535
bounds::Http2ClientConnExec,
3636
dispatch::{self, Callback, SendWhen, TrySendError},
3737
proto::{Dispatched, h2::UpgradedSendStream, headers},
38+
upgrade::{self, Upgraded},
3839
},
3940
common::{io::Compat, time::Time},
4041
error::BoxError,
4142
ext::{RequestConfig, RequestExtendedConnectProtocol, RequestOriginalHeaders},
4243
rt::{Read, Write},
43-
upgrade::Upgraded,
4444
};
4545

4646
type ClientRx<B> = dispatch::Receiver<Request<B>, Response<IncomingBody>>;
@@ -484,7 +484,7 @@ where
484484
let (parts, recv_stream) = res.into_parts();
485485
let mut res = Response::from_parts(parts, IncomingBody::empty());
486486

487-
let (pending, on_upgrade) = crate::core::upgrade::pending();
487+
let (pending, on_upgrade) = upgrade::pending();
488488
let io = H2Upgraded {
489489
ping,
490490
send_stream: unsafe { UpgradedSendStream::new(send_stream) },

src/core/client/proto/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
mod headers;
44

55
pub(crate) mod h1;
6+
pub(crate) mod h2;
67

78
pub(crate) use self::h1::{Conn, dispatch};
8-
9-
pub(crate) mod h2;
9+
use crate::core::client::upgrade;
1010

1111
/// An Incoming Message head. Includes request/status line, and headers.
1212
#[derive(Debug, Default)]
@@ -43,7 +43,7 @@ pub(crate) enum Dispatched {
4343
/// Dispatcher completely shutdown connection.
4444
Shutdown,
4545
/// Dispatcher has pending upgrade, and so did not shutdown.
46-
Upgrade(crate::core::upgrade::Pending),
46+
Upgrade(upgrade::Pending),
4747
}
4848

4949
impl MessageHead<http::StatusCode> {

src/core/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ mod error;
66
pub mod client;
77
pub mod ext;
88
pub mod rt;
9-
pub mod upgrade;
109

1110
pub use self::error::{Error, Result};

0 commit comments

Comments
 (0)