Skip to content

Commit

Permalink
remove direct dependent on openssl and rustls.
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeshadow committed Mar 30, 2024
1 parent 3c64f2b commit 0840487
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 0 additions & 2 deletions client/src/http_tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ const _: () = {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
match self.body {
ResponseBody::H1(ref mut body) => body.conn_mut().write(buf),

ResponseBody::H1Owned(ref mut body) => body.conn_mut().write(buf),
_ => unimplemented!("Write through HttpTunnel only supports http/1"),
}
Expand All @@ -227,7 +226,6 @@ const _: () = {
fn flush(&mut self) -> io::Result<()> {
match self.body {
ResponseBody::H1(ref mut body) => body.conn_mut().flush(),

ResponseBody::H1Owned(ref mut body) => body.conn_mut().flush(),
_ => unimplemented!("Write through HttpTunnel only supports http/1"),
}
Expand Down
11 changes: 4 additions & 7 deletions web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ http3 = ["__server", "xitca-http/http3"]
io-uring = ["__server", "xitca-server/io-uring"]

# tls transport layer
openssl = ["__server", "xitca-http/openssl", "openssl-crate"]
rustls = ["__server", "xitca-http/rustls", "rustls-crate"]
openssl = ["__server", "xitca-http/openssl", "xitca-tls/openssl"]
rustls = ["__server", "xitca-http/rustls", "xitca-tls/rustls"]

# params type extractor
params = ["serde"]
Expand Down Expand Up @@ -87,11 +87,8 @@ tokio = { version = "1", features = ["rt", "sync"] }
# http server
xitca-server = { version = "0.2", optional = true }

# openssl
openssl-crate = { package = "openssl", version = "0.10", optional = true }

# rustls
rustls-crate = { package = "rustls", version = "0.23", optional = true }
# tls
xitca-tls = { version = "0.2.2", optional = true }

# (de)serialization shared.
serde = { version = "1", optional = true }
Expand Down
8 changes: 4 additions & 4 deletions web/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ where
pub fn bind_openssl<A: std::net::ToSocketAddrs, ResB, BE>(
mut self,
addr: A,
mut builder: openssl_crate::ssl::SslAcceptorBuilder,
mut builder: xitca_tls::openssl::ssl::SslAcceptorBuilder,
) -> std::io::Result<Self>
where
S: Service + 'static,
Expand All @@ -228,11 +228,11 @@ where
Ok(b"h2")
}
#[cfg(not(feature = "http2"))]
Err(openssl_crate::ssl::AlpnError::ALERT_FATAL)
Err(xitca_tls::openssl::ssl::AlpnError::ALERT_FATAL)
} else if protocols.windows(9).any(|window| window == H11) {
Ok(b"http/1.1")
} else {
Err(openssl_crate::ssl::AlpnError::NOACK)
Err(xitca_tls::openssl::ssl::AlpnError::NOACK)
}
});

Expand Down Expand Up @@ -261,7 +261,7 @@ where
mut self,
addr: A,
#[cfg_attr(not(all(feature = "http1", feature = "http2")), allow(unused_mut))]
mut config: rustls_crate::ServerConfig,
mut config: xitca_tls::rustls::ServerConfig,
) -> std::io::Result<Self>
where
S: Service + 'static,
Expand Down

0 comments on commit 0840487

Please sign in to comment.