Skip to content

Commit a7f4414

Browse files
committed
Update for nginx PR 562.
1 parent 1523a9d commit a7f4414

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
rust-version:
3838
- stable
3939
nginx-ref:
40-
- master
40+
- e5de81af07b9495b8e439a9ff4f129e9f9e904ea
4141
- stable-1.28
4242
build:
4343
- debug

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,18 @@ fn detect_nginx_features() {
5454
// Generate cfg values for version checks
5555

5656
println!("cargo::rustc-check-cfg=cfg(ngx_ssl_cache)");
57+
println!("cargo::rustc-check-cfg=cfg(ngx_ssl_client_hello_cb)");
5758
println!("cargo::rerun-if-env-changed=DEP_NGINX_VERSION_NUMBER");
5859
if let Ok(version) = env::var("DEP_NGINX_VERSION_NUMBER") {
5960
let version: u64 = version.parse().unwrap();
6061

6162
if version >= 1_027_002 {
6263
println!("cargo::rustc-cfg=ngx_ssl_cache");
6364
}
65+
66+
if version >= 1_029_002 {
67+
println!("cargo::rustc-cfg=ngx_ssl_client_hello_cb");
68+
}
6469
}
6570
}
6671

src/acme/solvers/tls_alpn.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ impl SslClientHello {
216216
let this = Self(ssl);
217217

218218
match this.handler() {
219+
#[cfg(ngx_ssl_client_hello_cb)]
220+
Ok(false) => unsafe {
221+
nginx_sys::ngx_ssl_client_hello_callback(this.ssl().cast(), alert, ptr::null_mut())
222+
},
219223
Ok(_) => SSL_CLIENT_HELLO_SUCCESS,
220224
Err(Error::Decode) => {
221225
unsafe { *alert = openssl_sys::SSL_AD_DECODE_ERROR };
@@ -270,6 +274,10 @@ impl SslClientHello {
270274
.expect("SSL_CLIENT_HELLO is always valid in SSL_CTX callbacks");
271275

272276
match this.handler() {
277+
#[cfg(ngx_ssl_client_hello_cb)]
278+
Ok(false) => unsafe {
279+
nginx_sys::ngx_ssl_select_certificate(ptr::from_ref(&this.0).cast())
280+
},
273281
Ok(_) => openssl_sys::ssl_select_cert_result_t_ssl_select_cert_success,
274282
Err(err) => {
275283
ngx_log_error!(

0 commit comments

Comments
 (0)