Skip to content

Conversation

@osokin
Copy link

@osokin osokin commented Nov 20, 2025

Proposed changes

The proposed changes adopt the application make a check of nginx' version if the build's name start with "nginx".

These changes sponsored by: https://tipi.work/ - this's the part of the change, can't be removed.

Checklist

Before creating a PR, run through this checklist and mark each as complete:

@github-actions
Copy link

github-actions bot commented Nov 20, 2025

✅ All required contributors have signed the F5 CLA for this PR. Thank you!
Posted by the CLA Assistant Lite bot.

@osokin osokin marked this pull request as draft November 21, 2025 03:17
@osokin osokin changed the title Check version for nginx if build starts with nginx Check nginx' version if build name starts with "nginx" Nov 21, 2025
@osokin osokin marked this pull request as ready for review November 22, 2025 23:11
@osokin osokin changed the title Check nginx' version if build name starts with "nginx" Check nginx' version if build's name starts with "nginx" Nov 22, 2025
@osokin
Copy link
Author

osokin commented Dec 25, 2025

I have hereby read the F5 CLA and agree to its terms

Copy link
Member

@bavshin-f5 bavshin-f5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for delay, did not get a chance to review this before holidays.


println!("cargo::rustc-check-cfg=cfg(ngx_ssl_cache)");
println!("cargo::rustc-check-cfg=cfg(ngx_ssl_client_hello_cb)");
println!("cargo::rerun-if-env-changed=DEP_NGINX_VER_BUILD");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEP_NGINX_BUILD or DEP_NGINX_VERSION, see https://docs.rs/nginx-sys/0.5.0/nginx_sys/#version-and-build-information.
These environment variables are generated from cargo::metadata={name}=... in the nginx-sys buildscript, using DEP_{package.links}_{name} format. I'm afraid it's too late to change the metadata names to match the macros in nginx.h.

println!("cargo::rerun-if-env-changed=DEP_NGINX_VERSION_NUMBER");
if let Ok(version) = env::var("DEP_NGINX_VERSION_NUMBER") {
let version: u64 = version.parse().unwrap();
let build: String = env::var("DEP_NGINX_VER_BUILD").unwrap_or("any()".to_string());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.unwrap_or_default().

I'd also prefer to save the check state as a bool and use in subsequent conditionals, allowing future version checks for different projects:

let is_nginx = env::var("DEP_NGINX_VERSION").unwrap_or_default().starts_with("nginx/");

if is_nginx && version >= ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that requires an additional change in nginx-sys ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, everything I suggested here works with the current release of nginx-sys.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, sounds good to me, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants