aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs
index ee33d3f..31f8db7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -21,6 +21,7 @@ use error::ServiceError;
use futures::future::try_join_all;
use h3::error::ErrorLevel;
use h3_support::H3RequestBody;
+use http::header::{CONTENT_LENGTH, TRANSFER_ENCODING};
use http_body_util::{combinators::BoxBody, BodyExt};
use hyper::{
body::Incoming,
@@ -251,21 +252,15 @@ async fn serve_h3(state: Arc<State>) -> Result<()> {
let (mut send, recv) = stream.split();
let req = req.map(|()| H3RequestBody(recv).boxed());
- let resp = match service(
- state.clone(),
- req,
- addr,
- true,
- listen_addr,
- )
- .await
- {
- Ok(resp) => resp,
- Err(error) => error_response(addr, error),
- };
+ let resp = service(state.clone(), req, addr, true, listen_addr)
+ .await
+ .unwrap_or_else(|error| error_response(addr, error));
let (parts, mut body) = resp.into_parts();
- let resp = Response::from_parts(parts, ());
+ let mut resp = Response::from_parts(parts, ());
+
+ resp.headers_mut().remove(TRANSFER_ENCODING); // TODO allow "trailers" options
+ resp.headers_mut().remove(CONTENT_LENGTH);
if let Err(e) = send.send_response(resp).await {
debug!("h3 response send error: {e}");