Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,24 @@ fn main() {
}

// Generate cfg values for version checks
// println!("cargo::rustc-check-cfg=cfg(nginx1_27_0)");
// println!("cargo::rerun-if-env-changed=DEP_NGINX_VERSION_NUMBER");
// if let Ok(version) = std::env::var("DEP_NGINX_VERSION_NUMBER") {
// let version: u64 = version.parse().unwrap();
//
// if version >= 1_027_000 {
// println!("cargo::rustc-cfg=nginx1_27_0");
// }
// }
const VERSION_CHECKS: &[(u64, &str)] = &[
//
(1_021_001, "nginx1_21_1"),
(1_025_001, "nginx1_25_1"),
];
VERSION_CHECKS
.iter()
.for_each(|check| println!("cargo::rustc-check-cfg=cfg({})", check.1));
println!("cargo::rerun-if-env-changed=DEP_NGINX_VERSION_NUMBER");
if let Ok(version) = std::env::var("DEP_NGINX_VERSION_NUMBER") {
let version: u64 = version.parse().unwrap();

for check in VERSION_CHECKS {
if version >= check.0 {
println!("cargo::rustc-cfg={}", check.1);
}
}
}

// Generate required compiler flags
if cfg!(target_os = "macos") {
Expand Down
2 changes: 1 addition & 1 deletion nginx-sys/build/vendored.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ fn download(cache_dir: &Path, url: &str) -> Result<PathBuf, Box<dyn StdError>> {
// File does not exist or is zero bytes
!file_path.exists() || file_path.metadata().is_ok_and(|m| m.len() < 1)
}
let filename = url.split('/').last().unwrap();
let filename = url.split('/').next_back().unwrap();
let file_path = cache_dir.join(filename);
if proceed_with_download(&file_path) {
println!("Downloading: {} -> {}", url, file_path.display());
Expand Down
6 changes: 3 additions & 3 deletions src/http/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ mod upstream {

pub use upstream::NgxHttpUpstreamModule;

#[cfg(ngx_feature = "http_v2")]
#[cfg(all(nginx1_25_1, ngx_feature = "http_v2"))]
mod http_v2 {
use crate::ffi::{ngx_http_v2_module, ngx_http_v2_srv_conf_t};

Expand All @@ -256,8 +256,8 @@ mod http_v2 {
type ServerConf = ngx_http_v2_srv_conf_t;
}
}

#[cfg(ngx_feature = "http_v2")]
// ngx_http_v2_module was not exposed by default until aefd862a
#[cfg(all(nginx1_25_1, ngx_feature = "http_v2"))]
pub use http_v2::NgxHttpV2Module;

#[cfg(ngx_feature = "http_v3")]
Expand Down
33 changes: 17 additions & 16 deletions src/http/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,22 +557,23 @@ impl Method {
fn from_ngx(t: ngx_uint_t) -> Method {
let t = t as _;
match t {
NGX_HTTP_GET => Method(MethodInner::Get),
NGX_HTTP_HEAD => Method(MethodInner::Head),
NGX_HTTP_POST => Method(MethodInner::Post),
NGX_HTTP_PUT => Method(MethodInner::Put),
NGX_HTTP_DELETE => Method(MethodInner::Delete),
NGX_HTTP_MKCOL => Method(MethodInner::Mkcol),
NGX_HTTP_COPY => Method(MethodInner::Copy),
NGX_HTTP_MOVE => Method(MethodInner::Move),
NGX_HTTP_OPTIONS => Method(MethodInner::Options),
NGX_HTTP_PROPFIND => Method(MethodInner::Propfind),
NGX_HTTP_PROPPATCH => Method(MethodInner::Proppatch),
NGX_HTTP_LOCK => Method(MethodInner::Lock),
NGX_HTTP_UNLOCK => Method(MethodInner::Unlock),
NGX_HTTP_PATCH => Method(MethodInner::Patch),
NGX_HTTP_TRACE => Method(MethodInner::Trace),
NGX_HTTP_CONNECT => Method(MethodInner::Connect),
crate::ffi::NGX_HTTP_GET => Method(MethodInner::Get),
crate::ffi::NGX_HTTP_HEAD => Method(MethodInner::Head),
crate::ffi::NGX_HTTP_POST => Method(MethodInner::Post),
crate::ffi::NGX_HTTP_PUT => Method(MethodInner::Put),
crate::ffi::NGX_HTTP_DELETE => Method(MethodInner::Delete),
crate::ffi::NGX_HTTP_MKCOL => Method(MethodInner::Mkcol),
crate::ffi::NGX_HTTP_COPY => Method(MethodInner::Copy),
crate::ffi::NGX_HTTP_MOVE => Method(MethodInner::Move),
crate::ffi::NGX_HTTP_OPTIONS => Method(MethodInner::Options),
crate::ffi::NGX_HTTP_PROPFIND => Method(MethodInner::Propfind),
crate::ffi::NGX_HTTP_PROPPATCH => Method(MethodInner::Proppatch),
crate::ffi::NGX_HTTP_LOCK => Method(MethodInner::Lock),
crate::ffi::NGX_HTTP_UNLOCK => Method(MethodInner::Unlock),
crate::ffi::NGX_HTTP_PATCH => Method(MethodInner::Patch),
crate::ffi::NGX_HTTP_TRACE => Method(MethodInner::Trace),
#[cfg(nginx1_21_1)]
crate::ffi::NGX_HTTP_CONNECT => Method(MethodInner::Connect),
_ => Method(MethodInner::Unknown),
}
}
Expand Down
Loading