summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 8ca86cb..14675b4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -219,9 +219,15 @@ pub async fn serve_stream<T: Unpin + Send + 'static + hyper::rt::Read + hyper::r
async fn service(
state: Arc<State>,
config: Arc<Config>,
- request: Request<Incoming>,
+ mut request: Request<Incoming>,
addr: SocketAddr,
) -> Result<hyper::Response<BoxBody<bytes::Bytes, ServiceError>>, ServiceError> {
+ // copy uri authority used in HTTP/2 to Host header field
+ if let Some(host) = request.uri().authority().map(|a| a.host()) {
+ let host = HeaderValue::from_str(host).map_err(|_| ServiceError::InvalidHeader)?;
+ request.headers_mut().insert(HOST, host);
+ }
+
debug!(
"{addr} ~> {:?} {}",
request.headers().get(HOST),