fix(client): early server response shouldn't propagate NO_ERROR by DDtKey · Pull Request #3275 · hyperium/hyper

@DDtKey

Closes #2872

Added test is failing against the current version (before this fix)

Backport for 0.14.x: #3274

@DDtKey

Closes hyperium#2872

Added test is failing against version without these changes.

DDtKey

Some(Err(e)) => {
return match e.reason() {
// These reasons should cause stop of body reading, but don't fail it.
// The same logic as for `Read for H2Upgraded` is applied here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm referring to this line here:

Some(Reason::NO_ERROR) | Some(Reason::CANCEL) => Ok(()),

And it makes sense in terms of protocol behavior for the reasons.

Both of them call the same operation (self.recv_stream.poll_data(cx)) and seems that logic should be the same. But we can make it more specific.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, an additional example from another lang & lib where it was also solved by avoiding error if response has been read: square/okhttp#6295

@DDtKey DDtKey changed the title fix: early respond from server shouldn't propagate reset error fix: early server response shouldn't propagate reset error

Jul 23, 2023

@DDtKey DDtKey changed the title fix: early server response shouldn't propagate reset error fix: early server response shouldn't propagate NO_ERROR

Jul 23, 2023

@DDtKey DDtKey changed the title fix: early server response shouldn't propagate NO_ERROR fix(client): early server response shouldn't propagate NO_ERROR

Jul 23, 2023

@DDtKey

nox

nox approved these changes Jul 26, 2023

@nox nox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me given we already do something similar for streams upgraded from HTTP/2.

seanmonstar

0xE282B0 pushed a commit to 0xE282B0/hyper that referenced this pull request

Jan 12, 2024

0xE282B0 pushed a commit to 0xE282B0/hyper that referenced this pull request

Jan 16, 2024