okhttp: java.io.IOException: stream was reset: PROTOCOL_ERROR

Hi,

I’m using retrofit and seen found the error java.io.IOException: stream was reset: PROTOCOL_ERROR when connecting to: https://docs.google.com/a/google.com/spreadsheets/d/1TLV0JH_DJVb5KRQf56I_Cv6oZY-jHl6bYAIQ9QuBisk/export?gid=0&format=csv

Stacktrace:

java.io.IOException: stream was reset: PROTOCOL_ERROR
at com.squareup.okhttp.internal.framed.FramedStream.getResponseHeaders(FramedStream.java:146)
at com.squareup.okhttp.internal.http.FramedTransport.readResponseHeaders(FramedTransport.java:104)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:906)
at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:92)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:891)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:749)
at com.squareup.okhttp.Call.getResponse(Call.java:268)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:224)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:195)
at com.squareup.okhttp.Call.execute(Call.java:79)
at retrofit.OkHttpCall.execute(OkHttpCall.java:112)
at retrofit.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:59)
at (...)

This issue points to the same problem but was closed due to lack of information https://github.com/square/okhttp/issues/1195

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 21 (2 by maintainers)

Most upvoted comments

I worked around this (for WordPress at least) y forcing http1.1

I ran into this issue just now on 2.5.0. would you mind sharing your fix? In my case it’s wordpress public rest API giving the error.

add Protocl.HTTP_1_1 to httpClient.build method : OkHttpClient.Builder builder = new OkHttpClient. Builder(). protocols(Collections.singletonList(Protocol.HTTP_1_1)).