Skip to content

Commit 2448689

Browse files
erdemgokselerdemgoksel
authored andcommitted
v0.2.3: default feature rustls, native-tls uses openssl
1 parent cf911e6 commit 2448689

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## v0.2.3
4+
5+
Release date: 2026-03-26
6+
7+
### Changed
8+
9+
- **Default feature changed from `native-tls` to `rustls`**. The default build now uses `axum-server/tls-rustls` + `reqwest/rustls-tls` — pure Rust, no system dependencies.
10+
- `native-tls` feature now uses `axum-server/tls-openssl` for server-side TLS. Requires OpenSSL as a system library (`libssl-dev` on Ubuntu, `openssl-devel` on Fedora, vcpkg/`OPENSSL_DIR` on Windows).
11+
312
## v0.2.2
413

514
Release date: 2026-03-26
@@ -18,7 +27,10 @@ Release date: 2026-03-26
1827
- Any path prefix (e.g. `"/api"`) — nested via `Router::nest`, registered longest-first so more-specific paths shadow shorter ones.
1928
- `http_port` (top-level, default `3000`) — HTTP listen port.
2029
- `https_port` (top-level, optional) — HTTPS listen port. When set, `cert_path` and `key_path` are required.
21-
- `cert_path` / `key_path` — PEM certificate and private key paths for HTTPS. TLS is served via `axum-server` with rustls (pure-Rust, no system dependencies).
30+
- `cert_path` / `key_path` — PEM certificate and private key paths for HTTPS.
31+
- `rustls` feature (default): TLS via `axum-server/tls-rustls` — pure Rust, no system dependencies.
32+
- `native-tls` feature: TLS via `axum-server/tls-openssl` — requires OpenSSL installed as a system library.
33+
- **Default feature changed from `native-tls` to `rustls`**. Users who relied on the previous default must now explicitly opt in with `--features native-tls --no-default-features`.
2234
- Startup validation: missing cert/key when `https_port` is set, or an empty `server` map, produce a clear error before the server starts.
2335
- `control::create_control_router` now accepts `Vec<CacheHandle>`. A single `/refresh-cache` call invalidates all registered server caches.
2436

Cargo.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "phantom-frame"
3-
version = "0.2.2"
3+
version = "0.2.3"
44
edition = "2021"
55
authors = ["Erdem Göksel <erdem.goksel.dev@gmail.com>"]
66
description = "A high-performance prerendering proxy engine with caching support"
@@ -32,12 +32,8 @@ flate2 = "1.1"
3232
axum-server = { version = "0.7", optional = true }
3333

3434
[features]
35-
default = ["native-tls"]
36-
# Server-side TLS uses rustls via axum-server for both features.
37-
# axum-server has tls-rustls and tls-openssl but no SChannel (Windows native-tls);
38-
# rustls is pure-Rust and works on all platforms without system dependencies.
39-
# The native-tls feature only affects outbound reqwest client connections.
40-
native-tls = ["reqwest/native-tls", "dep:axum-server", "axum-server/tls-rustls"]
35+
default = ["rustls"]
36+
native-tls = ["reqwest/native-tls", "dep:axum-server", "axum-server/tls-openssl"]
4137
rustls = ["reqwest/rustls-tls", "dep:axum-server", "axum-server/tls-rustls"]
4238

4339
[lib]

src/main.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,7 @@ async fn run_https_server(
173173
start_tls(addr, cert_path, key_path, app).await
174174
}
175175

176-
// Server-side TLS uses rustls via axum-server for both the `rustls` and
177-
// `native-tls` features. axum-server supports tls-rustls and tls-openssl;
178-
// on Windows native-tls maps to SChannel which axum-server does not support,
179-
// and tls-openssl requires a system OpenSSL installation. rustls is
180-
// pure-Rust and works everywhere without system dependencies.
176+
#[cfg(feature = "rustls")]
181177
async fn start_tls(
182178
addr: std::net::SocketAddr,
183179
cert_path: PathBuf,
@@ -191,3 +187,18 @@ async fn start_tls(
191187
.await
192188
.map_err(Into::into)
193189
}
190+
191+
#[cfg(feature = "native-tls")]
192+
async fn start_tls(
193+
addr: std::net::SocketAddr,
194+
cert_path: PathBuf,
195+
key_path: PathBuf,
196+
app: Router,
197+
) -> anyhow::Result<()> {
198+
let tls_config =
199+
axum_server::tls_openssl::OpenSSLConfig::from_pem_file(cert_path, key_path)?;
200+
axum_server::bind_openssl(addr, tls_config)
201+
.serve(app.into_make_service())
202+
.await
203+
.map_err(Into::into)
204+
}

0 commit comments

Comments
 (0)