fix expect handling

This commit is contained in:
fakeshadow 2021-02-03 05:10:51 -08:00
parent 15b8dba2c7
commit 2aa07e016d
1 changed files with 4 additions and 8 deletions

View File

@ -330,12 +330,6 @@ where
Ok(()) Ok(())
} }
fn send_continue(self: Pin<&mut Self>) {
self.project()
.write_buf
.extend_from_slice(b"HTTP/1.1 100 Continue\r\n\r\n");
}
fn poll_response( fn poll_response(
mut self: Pin<&mut Self>, mut self: Pin<&mut Self>,
cx: &mut Context<'_>, cx: &mut Context<'_>,
@ -377,8 +371,8 @@ where
// expect resolved. write continue to buffer and set InnerDispatcher state // expect resolved. write continue to buffer and set InnerDispatcher state
// to service call. // to service call.
Poll::Ready(Ok(req)) => { Poll::Ready(Ok(req)) => {
self.as_mut().send_continue(); this.write_buf
this = self.as_mut().project(); .extend_from_slice(b"HTTP/1.1 100 Continue\r\n\r\n");
let fut = this.flow.service.call(req); let fut = this.flow.service.call(req);
this.state.set(State::ServiceCall(fut)); this.state.set(State::ServiceCall(fut));
} }
@ -488,6 +482,8 @@ where
match fut.poll(cx) { match fut.poll(cx) {
// expect is resolved. continue loop and poll the service call branch. // expect is resolved. continue loop and poll the service call branch.
Poll::Ready(Ok(req)) => { Poll::Ready(Ok(req)) => {
this.write_buf
.extend_from_slice(b"HTTP/1.1 100 Continue\r\n\r\n");
let task = this.flow.service.call(req); let task = this.flow.service.call(req);
this.state.as_mut().set(State::ServiceCall(task)); this.state.as_mut().set(State::ServiceCall(task));
} }