Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joelwurtz
Copy link
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.

@joelwurtz joelwurtz force-pushed the feat/h1-check-eof branch 2 times, most recently from e74acd9 to 6745229 Compare February 13, 2025 10:58
…, add middleware to retry sending request for this error
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.

1 participant