Skip to content

Commit a5d51a6

Browse files
authored
Fix SendService trait bound (#171)
* Fix SendService trait bound * Bump rust version and crate version * Use libssl-dev * Set openssl to minimal version
1 parent f60b615 commit a5d51a6

9 files changed

Lines changed: 32 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
matrix:
103103
rust:
104104
- { version: stable, msrv: false }
105-
- { name: "MSRV", version: 1.66, msrv: true }
105+
- { name: "MSRV", version: 1.82, msrv: true }
106106
features:
107107
- { features: "" }
108108
- { name: "(`tls-rustls`)", features: --features tls-rustls }
@@ -178,14 +178,13 @@ jobs:
178178
- name: Install OpenSSL
179179
if: matrix.features.openssl == true
180180
run: |
181-
sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu focal-updates main"
182181
sudo apt update
183-
sudo apt-get install --allow-downgrades pkg-config libssl-dev=1.1.1f-1ubuntu2.23
182+
sudo apt-get install pkg-config libssl-dev
184183
- name: Install Nightly Rust
185184
uses: dtolnay/rust-toolchain@nightly
186185
- name: Update to Minimal Versions
187186
run: cargo update -Zminimal-versions
188187
- name: Install Rust
189-
uses: dtolnay/rust-toolchain@1.66
188+
uses: dtolnay/rust-toolchain@1.82
190189
- name: Run Cargo Build
191190
run: cargo build ${{ matrix.features.features }}

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ license = "MIT"
99
name = "axum-server"
1010
readme = "README.md"
1111
repository = "https://github.com/programatik29/axum-server"
12-
version = "0.7.2"
13-
rust-version = "1.66"
12+
version = "0.7.3"
13+
rust-version = "1.82"
1414

1515
[features]
1616
default = []
1717
tls-rustls = ["tls-rustls-no-provider", "rustls/aws-lc-rs"]
1818
tls-rustls-no-provider = ["arc-swap", "rustls", "rustls-pemfile", "tokio/fs", "tokio/time", "tokio-rustls", "rustls-pki-types", "dep:pin-project-lite"]
19-
tls-openssl = ["arc-swap", "openssl", "tokio-openssl", "dep:pin-project-lite"]
19+
tls-openssl = ["arc-swap", "openssl", "openssl-sys", "tokio-openssl", "dep:pin-project-lite"]
2020

2121
[dependencies]
2222
bytes = "1"
@@ -37,7 +37,8 @@ rustls-pemfile = { version = "2.1", optional = true }
3737
tokio-rustls = { version = "0.26", default-features = false, optional = true }
3838

3939
## openssl
40-
openssl = { version = "0.10", optional = true }
40+
openssl = { version = "0.10.61", optional = true }
41+
openssl-sys = { version = "0.9.97", optional = true }
4142
tokio-openssl = { version = "0.6", optional = true }
4243

4344
## rustls or openssl

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can find more examples [here](/examples).
4141

4242
## Minimum Supported Rust Version
4343

44-
axum-server's MSRV is `1.66`.
44+
axum-server's MSRV is `1.82`.
4545

4646
## Safety
4747

src/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use hyper_util::{
1313
use std::{
1414
fmt,
1515
future::poll_fn,
16-
io::{self, ErrorKind},
16+
io::{self},
1717
net::SocketAddr,
1818
time::Duration,
1919
};
@@ -265,7 +265,7 @@ pub(crate) async fn accept(listener: &mut TcpListener) -> (TcpStream, SocketAddr
265265
type BoxError = Box<dyn std::error::Error + Send + Sync>;
266266

267267
pub(crate) fn io_other<E: Into<BoxError>>(error: E) -> io::Error {
268-
io::Error::new(ErrorKind::Other, error)
268+
io::Error::other(error)
269269
}
270270

271271
#[cfg(test)]

src/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub trait SendService<Request>: send_service::Sealed<Request> {
2323
+ 'static;
2424

2525
type Body: Body<Data = Self::BodyData, Error = Self::BodyError> + Send + 'static;
26-
type BodyData: Send + 'static;
26+
type BodyData: bytes::Buf + Send + 'static;
2727
type BodyError: Into<Box<dyn std::error::Error + Send + Sync>>;
2828

2929
type Error: Into<Box<dyn std::error::Error + Send + Sync>>;

src/tls_openssl/future.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ where
7272

7373
Poll::Ready(Ok(tls_stream))
7474
}
75-
Poll::Ready(Err(e)) => Poll::Ready(Err(Error::new(ErrorKind::Other, e))),
75+
Poll::Ready(Err(e)) => Poll::Ready(Err(io::Error::other(e))),
76+
7677
Poll::Pending => Poll::Pending,
7778
}
7879
}
@@ -159,7 +160,7 @@ where
159160
}
160161
Poll::Ready(Ok(Err(e))) => return Poll::Ready(Err(e)),
161162
Poll::Ready(Err(timeout)) => {
162-
return Poll::Ready(Err(Error::new(ErrorKind::TimedOut, timeout)))
163+
return Poll::Ready(Err(Error::new(ErrorKind::TimedOut, timeout)));
163164
}
164165
Poll::Pending => return Poll::Pending,
165166
},

src/tls_openssl/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ impl TryFrom<SslAcceptorBuilder> for OpenSSLConfig {
249249
/// // Set configurations like set_certificate_chain_file or
250250
/// // set_private_key_file.
251251
/// // let tls_builder.set_ ... ;
252-
253252
/// let _config = OpenSSLConfig::try_from(tls_builder);
254253
/// }
255254
/// ```

src/tls_rustls/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ where
104104
}
105105
Poll::Ready(Ok(Err(e))) => return Poll::Ready(Err(e)),
106106
Poll::Ready(Err(timeout)) => {
107-
return Poll::Ready(Err(Error::new(ErrorKind::TimedOut, timeout)))
107+
return Poll::Ready(Err(Error::new(ErrorKind::TimedOut, timeout)));
108108
}
109109
Poll::Pending => return Poll::Pending,
110110
},

src/tls_rustls/mod.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,10 @@ mod tests {
586586
.await
587587
.unwrap_err();
588588
assert_eq!(err.kind(), io::ErrorKind::NotFound);
589-
assert_eq!(err.to_string(), "failed to read from file `examples/self-signed-certs/missing.pem`: No such file or directory (os error 2)");
589+
assert_eq!(
590+
err.to_string(),
591+
"failed to read from file `examples/self-signed-certs/missing.pem`: No such file or directory (os error 2)"
592+
);
590593

591594
let err = RustlsConfig::from_pem_file(
592595
"examples/self-signed-certs/cert.pem",
@@ -595,7 +598,10 @@ mod tests {
595598
.await
596599
.unwrap_err();
597600
assert_eq!(err.kind(), io::ErrorKind::NotFound);
598-
assert_eq!(err.to_string(), "failed to read from file `examples/self-signed-certs/missing.pem`: No such file or directory (os error 2)");
601+
assert_eq!(
602+
err.to_string(),
603+
"failed to read from file `examples/self-signed-certs/missing.pem`: No such file or directory (os error 2)"
604+
);
599605
}
600606

601607
#[tokio::test]
@@ -607,7 +613,10 @@ mod tests {
607613
.await
608614
.unwrap_err();
609615
assert_eq!(err.kind(), io::ErrorKind::NotFound);
610-
assert_eq!(err.to_string(), "failed to read from file `examples/self-signed-certs/missing.pem`: No such file or directory (os error 2)");
616+
assert_eq!(
617+
err.to_string(),
618+
"failed to read from file `examples/self-signed-certs/missing.pem`: No such file or directory (os error 2)"
619+
);
611620

612621
let err = RustlsConfig::from_pem_chain_file(
613622
"examples/self-signed-certs/cert.pem",
@@ -616,6 +625,9 @@ mod tests {
616625
.await
617626
.unwrap_err();
618627
assert_eq!(err.kind(), io::ErrorKind::NotFound);
619-
assert_eq!(err.to_string(), "failed to read from file `examples/self-signed-certs/missing.pem`: No such file or directory (os error 2)");
628+
assert_eq!(
629+
err.to_string(),
630+
"failed to read from file `examples/self-signed-certs/missing.pem`: No such file or directory (os error 2)"
631+
);
620632
}
621633
}

0 commit comments

Comments
 (0)