We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 840d789 commit 0ca0bc9Copy full SHA for 0ca0bc9
src/http/request.rs
@@ -211,8 +211,12 @@ impl Request {
211
/// Client HTTP [User-Agent].
212
///
213
/// [User-Agent]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
214
- pub fn user_agent(&self) -> &NgxStr {
215
- unsafe { NgxStr::from_ngx_str((*self.0.headers_in.user_agent).value) }
+ pub fn user_agent(&self) -> Option<&NgxStr> {
+ if !self.0.headers_in.user_agent.is_null() {
216
+ unsafe { Some(NgxStr::from_ngx_str((*self.0.headers_in.user_agent).value)) }
217
+ } else {
218
+ None
219
+ }
220
}
221
222
/// Set HTTP status of response.
0 commit comments