From 400c568f8e0bcf3a5613e6fd09225b16c6ee8785 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 15 Oct 2020 17:49:17 +0200 Subject: [PATCH] server: rest: also log the query part of URL As it is part of the request and we do so in our other products Signed-off-by: Thomas Lamprecht --- src/server/rest.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/rest.rs b/src/server/rest.rs index 55a42ac5..7305643c 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -111,7 +111,7 @@ pub struct ApiService { fn log_response( peer: &std::net::SocketAddr, method: hyper::Method, - path: &str, + path_query: &str, resp: &Response, ) { @@ -119,7 +119,7 @@ fn log_response( // we also log URL-to-long requests, so avoid message bigger than PIPE_BUF (4k on Linux) // to profit from atomicty guarantees for O_APPEND opened logfiles - let path = &path[..MAX_URI_QUERY_LENGTH.min(path.len())]; + let path = &path_query[..MAX_URI_QUERY_LENGTH.min(path_query.len())]; let status = resp.status(); @@ -156,7 +156,7 @@ impl tower_service::Service> for ApiService { } fn call(&mut self, req: Request) -> Self::Future { - let path = req.uri().path().to_owned(); + let path = req.uri().path_and_query().unwrap().as_str().to_owned(); let method = req.method().clone(); let config = Arc::clone(&self.api_config);