check final response in poll_informational#889
Conversation
a5c966d to
3ace95f
Compare
|
Thanks for the PR! I looked at the code already in the function, and noticed some things. Since it matches |
|
This is the code I used: fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Result<Response<()>, Error>> {
if let Some(r) = ready!(self.rsp_fut.poll_informational(cx)) {
return Poll::Ready(r);
}
let r = ready!(Pin::new(&mut self.rsp_fut).poll(cx))?;
// ...
}I have to know there won't be any informational headers so I can |
|
Hm, ok. I wonder, would it possible to add a test to https://github.com/hyperium/h2/blob/master/tests/h2-tests/tests/informational_responses.rs that fails without this change? 🤓 |
Added one here: #890 |
3ace95f to
4a0a1c0
Compare
seanmonstar
left a comment
There was a problem hiding this comment.
Got it, thanks for the test!
Make sure
poll_informationalreturnsPoll::Ready(None)after the final response received. So the caller can then use theResponseFuture::poll()method to get the final response.The lock in
OpaqueStreamRefget released whenpoll_informationalreturned, so if it didn't returnsPoll::Ready(None)on received final response header, the caller has to callResponseFuture::poll()every time to check the final response, this may get some informational response get ignored.