Recover from REFUSED_STREAM in HTTP/2
See original GitHub issueOkHttp promises to persevere when there’s trouble, but it doesn’t recover from REFUSED_STREAM
in HTTP/2. We should transparently retry when an HTTP/2 server returns a REFUSED_STREAM
error.
We should set noNewStreams = true
on the connection that refused the stream. That is a good enough policy that’s in spirit of the HTTP/2 spec: it’ll prevent the connection from being used for any future streams. Then when we retry we’ll get a different connection and with any luck that one will accept the stream.
We need a special case if the refused stream’s streamId is 1. That will let us recover when Nginx refuses request bodies sent before the settings ack. In that case we should retry on the same physical connection, which we can assume has since ACK’d the settings. It’s still a little bit racy, but unlikely to be a problem in practice. More discussion on this workaround on issue 2506 and on the http-wg list.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (5 by maintainers)
Top GitHub Comments
A quick update: nginx attached a proposed patch on their issue tracker. I tested patch against OkHttp and it worked perfectly.
Is this an okhttp or an nginx problem? People are starting to become nervous because clients which use okhttp (like DAVdroid) don’t work with their (up-to-date) nginx servers anymore… how do you recommend to handle this? Disable HTTP2 in okhttp?