Skip to content

Commit

Permalink
Added ngx_http_request::accept_encoding()
Browse files Browse the repository at this point in the history
  • Loading branch information
gabioprisan committed Dec 11, 2023
1 parent a181ae9 commit b0f8fac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nginx_module/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nginx_module"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
build = "build.rs"
authors = ["Gabriel Oprisan <gabriel.oprisan@gcore.com>"]
Expand Down
12 changes: 12 additions & 0 deletions nginx_module/src/http_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,16 @@ impl<'a> HttpRequest<'a> {
}
}
}

pub fn accept_encoding(&self) -> Option<NgxStr<'a>> {
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))
}
}
}
}

0 comments on commit b0f8fac

Please sign in to comment.