Skip to content

feat(client): check correct state of h1 stream before sending request#1209

Closed
joelwurtz wants to merge 1 commit intoHFQR:mainfrom
joelwurtz:feat/h1-check-eof
Closed

feat(client): check correct state of h1 stream before sending request#1209
joelwurtz wants to merge 1 commit intoHFQR:mainfrom
joelwurtz:feat/h1-check-eof

Conversation

@joelwurtz
Copy link
Copy Markdown
Contributor

@joelwurtz joelwurtz commented Feb 13, 2025

This PR replace #1176

A different approach is used here

Mainly we try to read 1 byte from the stream in a sync way, since we didn't send anything yet we should receive a WouldBlock io error, if we doesn't receive this it either means :

  • the stream is in a different error so it should be closed
  • the stream has some data left and then is in an incorrect state so we should close it
  • the stream has been closed (so we should closed it also)

Retrying here should be safer since we don't consume request, i still use a middleware so user will opt in for this feature

I only handled the h1 connection closed error here, we could add other cases later when request could be retried safely in those cases

@joelwurtz

This comment was marked as outdated.

…, add middleware to retry sending request for this error
@fakeshadow
Copy link
Copy Markdown
Collaborator

#1358 should be fixing this.
During client pooling refactor a Ready trait is added before checking out a connection. It helps us despawn dead connection then in replace respawn. It handles h1 and h2 connection health without error reporting currently. Once the h3 support is also added we can explore how to better handling error case for it

@joelwurtz
Copy link
Copy Markdown
Contributor Author

Indeed i was actually looking at the recent changes, will updates my pr accordingly, let me know if i can help in any way

@joelwurtz
Copy link
Copy Markdown
Contributor Author

I'm closing this, it's no longer the case, thanks.

@joelwurtz joelwurtz closed this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants