Skip to content

Commit

Permalink
fix: openssl lifetime issue when use version 0.10.70 (#1046)
Browse files Browse the repository at this point in the history
* fix: openssl lifetime issue when use version 0.10.70

* fmt
  • Loading branch information
chrislearn authored Feb 3, 2025
1 parent d72333d commit 8f1c745
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ multer = "3"
multimap = "0.10"
native-tls = "0.2"
nix = { version = "0.29", default-features = false }
openssl = "0.10"
openssl = { version = ">=0.10.0, <=0.10.69" }
opentelemetry = { version = "0.27", default-features = false }
opentelemetry-http = { version = "0.27", default-features = false }
opentelemetry-prometheus = { version = "0.27", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions crates/core/src/conn/openssl/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::path::Path;

use futures_util::stream::{once, Once, Stream};
use openssl::pkey::PKey;
use openssl::ssl::{SslAcceptor, SslMethod, SslRef};
use openssl::ssl::{SslAcceptor, SslMethod};
use openssl::x509::X509;
use tokio::io::ErrorKind;

Expand Down Expand Up @@ -163,9 +163,9 @@ impl OpensslConfig {

// set ALPN protocols
let alpn_protocols = self.alpn_protocols.clone();
builder.set_alpn_protos(&alpn_protocols)?;
builder.set_alpn_protos(&self.alpn_protocols)?;
// set uo ALPN selection routine - as select_next_proto
builder.set_alpn_select_callback(move |_: &mut SslRef, list: &[u8]| {
builder.set_alpn_select_callback(move |_, list| {
openssl::ssl::select_next_proto(&alpn_protocols, list).ok_or(openssl::ssl::AlpnError::NOACK)
});
if let Some(modifier) = &mut self.builder_modifier {
Expand Down
13 changes: 3 additions & 10 deletions examples/todos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,14 @@ fn index(res: &mut Response) {
<body>
<a href=\"/todos\">going to the todo page</a>
</body>
</html>"
</html>",
));
}

fn route() -> Router {
Router::new()
.push(
Router::new()
.get(index)
)
.push(
Router::new()
.path("todos")
.push(todo_route())
)
.push(Router::new().get(index))
.push(Router::new().path("todos").push(todo_route()))
}

fn todo_route() -> Router {
Expand Down

0 comments on commit 8f1c745

Please sign in to comment.