Skip to content

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

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

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
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
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.

2 participants