basic body

This commit is contained in:
Lucio Franco
2019-08-12 12:43:32 -04:00
parent 845715e7a2
commit 6b6e775ebd
19 changed files with 5013 additions and 42 deletions
+22 -22
View File
@@ -30,7 +30,7 @@ where
Self {
maker,
builder,
_pd: PhantomData
_pd: PhantomData,
}
}
@@ -79,30 +79,30 @@ where
}
pub async fn handle_request<B>(
response: Response<B>,
mut send_response: h2::server::SendResponse<SendBuf<B::Data>>,
) where
B: Body + Send + Unpin + 'static,
B::Data: Unpin,
B::Error: Into<Box<dyn std::error::Error>>,
{
let (parts, body) = response.into_parts();
response: Response<B>,
mut send_response: h2::server::SendResponse<SendBuf<B::Data>>,
) where
B: Body + Send + Unpin + 'static,
B::Data: Unpin,
B::Error: Into<Box<dyn std::error::Error>>,
{
let (parts, body) = response.into_parts();
// Check if the response is imemdiately an end-of-stream.
let eos = body.is_end_stream();
// Check if the response is imemdiately an end-of-stream.
let eos = body.is_end_stream();
let response = Response::from_parts(parts, ());
let response = Response::from_parts(parts, ());
match send_response.send_response(response, eos) {
Ok(sr) => {
if eos {
return;
}
Flush::new(body, sr).await.unwrap();
}
Err(e) => {
println!("h2 server ERROR={}", e);
match send_response.send_response(response, eos) {
Ok(sr) => {
if eos {
return;
}
Flush::new(body, sr).await.unwrap();
}
Err(e) => {
println!("h2 server ERROR={}", e);
}
}
}