diff --git a/nginx_module/Cargo.toml b/nginx_module/Cargo.toml index c5cdbc0..63785e8 100644 --- a/nginx_module/Cargo.toml +++ b/nginx_module/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nginx_module" -version = "0.1.3" +version = "0.1.4" edition = "2021" build = "build.rs" authors = ["Gabriel Oprisan "] diff --git a/nginx_module/src/http_request.rs b/nginx_module/src/http_request.rs index a9c55bd..dc09ede 100644 --- a/nginx_module/src/http_request.rs +++ b/nginx_module/src/http_request.rs @@ -340,4 +340,16 @@ impl<'a> HttpRequest<'a> { } } } + + pub fn accept_encoding(&self) -> Option> { + let accept_enconding_entry = self.0.headers_in.accept_encoding; + if accept_enconding_entry.is_null() { + None + } else { + unsafe { + let accept_encoding = (*accept_enconding_entry).value; + Some(NgxStr::from_raw(accept_encoding)) + } + } + } }