From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH backup 2/4] server: rest: also log the query part of URL
Date: Thu, 15 Oct 2020 17:49:17 +0200 [thread overview]
Message-ID: <20201015154919.19776-3-t.lamprecht@proxmox.com> (raw)
In-Reply-To: <20201015154919.19776-1-t.lamprecht@proxmox.com>
As it is part of the request and we do so in our other products
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
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<Body>,
) {
@@ -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<Request<Body>> for ApiService {
}
fn call(&mut self, req: Request<Body>) -> 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);
--
2.27.0
next prev parent reply other threads:[~2020-10-15 15:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-15 15:49 [pbs-devel] Preperation patches for access/auth log Thomas Lamprecht
2020-10-15 15:49 ` [pbs-devel] [PATCH backup 1/4] server: rest: implement max URI path and query length request limits Thomas Lamprecht
2020-10-16 8:45 ` [pbs-devel] applied: " Dietmar Maurer
2020-10-15 15:49 ` Thomas Lamprecht [this message]
2020-10-16 8:46 ` [pbs-devel] applied: [PATCH backup 2/4] server: rest: also log the query part of URL Dietmar Maurer
2020-10-15 15:49 ` [pbs-devel] [PATCH backup 3/4] tools: file logger: use option struct to control behavior Thomas Lamprecht
2020-10-16 8:44 ` Dietmar Maurer
2020-10-16 8:46 ` Thomas Lamprecht
2020-10-15 15:49 ` [pbs-devel] [PATCH backup 4/4] tools: file logger: allow more control over file creation and log format Thomas Lamprecht
2020-10-16 8:51 ` [pbs-devel] applied: " Dietmar Maurer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201015154919.19776-3-t.lamprecht@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox