mirror of https://github.com/fafhrd91/actix-web
parent
8bed235e5f
commit
d551c8adf9
|
@ -83,12 +83,12 @@ where
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
framed.send((head, body.size()).into()).await?;
|
|
||||||
|
|
||||||
let mut pin_framed = Pin::new(&mut framed);
|
let mut pin_framed = Pin::new(&mut framed);
|
||||||
|
|
||||||
// special handle for EXPECT request.
|
// special handle for EXPECT request.
|
||||||
let (do_send, mut res_head) = if is_expect {
|
let (do_send, mut res_head) = if is_expect {
|
||||||
|
pin_framed.send((head, body.size()).into()).await?;
|
||||||
|
|
||||||
let head = poll_fn(|cx| pin_framed.as_mut().poll_next(cx))
|
let head = poll_fn(|cx| pin_framed.as_mut().poll_next(cx))
|
||||||
.await
|
.await
|
||||||
.ok_or(ConnectError::Disconnected)??;
|
.ok_or(ConnectError::Disconnected)??;
|
||||||
|
@ -97,13 +97,17 @@ where
|
||||||
// and current head would be used as final response head.
|
// and current head would be used as final response head.
|
||||||
(head.status == StatusCode::CONTINUE, Some(head))
|
(head.status == StatusCode::CONTINUE, Some(head))
|
||||||
} else {
|
} else {
|
||||||
|
pin_framed.feed((head, body.size()).into()).await?;
|
||||||
|
|
||||||
(true, None)
|
(true, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
if do_send {
|
if do_send {
|
||||||
// send request body
|
// send request body
|
||||||
match body.size() {
|
match body.size() {
|
||||||
BodySize::None | BodySize::Sized(0) => {}
|
BodySize::None | BodySize::Sized(0) => {
|
||||||
|
poll_fn(|cx| pin_framed.as_mut().flush(cx)).await?;
|
||||||
|
}
|
||||||
_ => send_body(body, pin_framed.as_mut()).await?,
|
_ => send_body(body, pin_framed.as_mut()).await?,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue