aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCongyu WANG <[email protected]>2024-08-07 07:36:06 +0000
committerEdward Wang <[email protected]>2024-08-16 10:36:11 -0700
commita1f7b62367b65b950e60047d0f5c7ac6d3ff6b35 (patch)
tree1bca330a1be8852f3c1d341ce92c99f5f95ceeab
parent50c3687e837e1380e7806900849c1df2f491e715 (diff)
downloadpingora-a1f7b62367b65b950e60047d0f5c7ac6d3ff6b35.tar.gz
pingora-a1f7b62367b65b950e60047d0f5c7ac6d3ff6b35.zip
fix h2 request_summary
--- also add port number --- also print query with path for h2 just as h1 Includes-commit: 2df4e29e180f5e79bee04aa4b4d83536e9f7f3a4 Includes-commit: 53e1810a27de581f6d5a9606198d9ac443f4a63c Includes-commit: 8102a0900bf30bf740e58c3a541bb86d296eb660 Replicated-from: https://github.com/cloudflare/pingora/pull/345
-rw-r--r--.bleep2
-rw-r--r--pingora-core/src/protocols/http/v2/server.rs17
2 files changed, 13 insertions, 6 deletions
diff --git a/.bleep b/.bleep
index 9c45175..44a405d 100644
--- a/.bleep
+++ b/.bleep
@@ -1 +1 @@
-f123f5e43e9ada31a0e541b917ea674527fd06a3 \ No newline at end of file
+352835e0dc76946e3fd5e8c536d5c080d0b1ddb6 \ No newline at end of file
diff --git a/pingora-core/src/protocols/http/v2/server.rs b/pingora-core/src/protocols/http/v2/server.rs
index 5bd6bc0..447a4e3 100644
--- a/pingora-core/src/protocols/http/v2/server.rs
+++ b/pingora-core/src/protocols/http/v2/server.rs
@@ -20,6 +20,7 @@ use h2::server;
use h2::server::SendResponse;
use h2::{RecvStream, SendStream};
use http::header::HeaderName;
+use http::uri::PathAndQuery;
use http::{header, HeaderMap, Response};
use log::{debug, warn};
use pingora_http::{RequestHeader, ResponseHeader};
@@ -346,13 +347,19 @@ impl HttpSession {
/// Return a string `$METHOD $PATH $HOST`. Mostly for logging and debug purpose
pub fn request_summary(&self) -> String {
format!(
- "{} {}, Host: {}",
+ "{} {}, Host: {}:{}",
self.request_header.method,
- self.request_header.uri,
self.request_header
- .headers
- .get(header::HOST)
- .map(|v| String::from_utf8_lossy(v.as_bytes()))
+ .uri
+ .path_and_query()
+ .map(PathAndQuery::as_str)
+ .unwrap_or_default(),
+ self.request_header.uri.host().unwrap_or_default(),
+ self.req_header()
+ .uri
+ .port()
+ .as_ref()
+ .map(|port| port.as_str())
.unwrap_or_default()
)
}