You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Okhttp fails when there is REFUSED_STREAM in HTTP/2. This happens with newer versions of nginx that use HTTP/2. GET requests get processed correctly, however, for POST, it fails with nginx complaining that the client prematurely closed the stream.
client sent stream with data before settings were acknowledged while processing HTTP/2 connection
Because of this, okhttp does not work with some of the newer nginx servers.
The fix is to configure OkHttpClient with other protocols for it to use. Here's the fix -- wallabag/android-app#256.
As per OkHttp's javadocs,
The client will prefer the most efficient transport available, falling back to more ubiquitous protocols.
If multiple protocols are specified, ALPN will be used to negotiate a transport.
However, if you enable all possible protocols (like I tried in the PR here #7641), you will still get PROTOCOL_ERRORS maybe half the time. So instead of the change, the solution might be to add this to your MainActivity.
Activity
AndrewJack commentedon May 20, 2016
lysine-dev/okhttp#2543 (comment)