[Android] Fix for REFUSED_STREAM with Okhttp#7641
Closed
rahuljiresal wants to merge 1 commit into
Closed
Conversation
|
By analyzing the blame information on this pull request, we identified @AndrewJack and @lexs to be potential reviewers. |
Author
|
Sorry, the solution in this PR does not work because even if you enable all protocols, you still get Anyway, I'm gonna close this PR and have an issue for anyone who faces the same problem. |
| List<Protocol> protocolList = new ArrayList<>(); | ||
| protocolList.add(Protocol.HTTP_2); | ||
| protocolList.add(Protocol.SPDY_3); | ||
| protocolList.add(Protocol.HTTP_1_1); |
Contributor
There was a problem hiding this comment.
The Pull request that you referenced referenced, works around the issue by removing the HTTP_2 protocol.
Contributor
|
This workaround will work if you remove the Still only a workaround, as Jessie said here it'll require a code change for Nginx and okhttp to fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Okhttp fails when there is
REFUSED_STREAMin 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 connectionMore info here - square/okhttp#2543 and square/okhttp#2506
Because of this, okhttp does not work with some of the newer nginx servers.
The fix is to configure
OkHttpClientwith other protocols for it to use. Here's the fix -- wallabag/android-app#256.As per OkHttp's javadocs,
This should make it work with them all nginx servers.