From 870683049b09747705c93a036d10d801e3a462b4 Mon Sep 17 00:00:00 2001 From: mtb0x1 <39337159+mtb0x1@users.noreply.github.com> Date: Wed, 25 Oct 2023 20:07:46 +0200 Subject: [PATCH] fix(#50): user_agent method returns 'Option<&NgxStr>' and not '&NgxStr' --- examples/curl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/curl.rs b/examples/curl.rs index d0bbb43..4951568 100644 --- a/examples/curl.rs +++ b/examples/curl.rs @@ -111,7 +111,7 @@ http_request_handler!(curl_access_handler, |request: &mut http::Request| { match co.enable { true => { - if request.user_agent().as_bytes().starts_with(b"curl") { + if request.user_agent().is_some_and(|ua| ua.as_bytes().starts_with(b"curl")) { http::HTTPStatus::FORBIDDEN.into() } else { core::Status::NGX_DECLINED