google / cronet-transport-for-okhttp

This package allows OkHttp and Retrofit users to use Cronet as their transport layer, benefiting from features like QUIC/HTTP3 support or connection migration.
Apache License 2.0
427 stars 31 forks source link

java.io.IOException: Content-Length (2472) and stream length (9805) disagree #2

Closed ag2s20150909 closed 2 years ago

ag2s20150909 commented 2 years ago
java.io.IOException: Content-Length (2472) and stream length (9805) disagree
at okhttp3.ResponseBody.bytes(ResponseBody.kt:330)

https://github.com/google/cronet-transport-for-okhttp/blob/eba6b03e2e5a7b659023047122a0a44c835f6bc7/java/com/google/net/cronet/okhttptransport/ResponseConverter.java#L117-L120

when server use compression methods like Gzip,Brotli and ect.The returned Content-Length is not equal to the actual stream length(Cronet has decompressed the compressed data)

https://github.com/google/cronet-transport-for-okhttp/blob/eba6b03e2e5a7b659023047122a0a44c835f6bc7/java/com/google/net/cronet/okhttptransport/OkHttpBridgeRequestCallback.java#L252-L256

Danstahrg commented 2 years ago

Thank you for the report! I'll take a look.

Danstahrg commented 2 years ago

This has been addressed in 64c95224ff839291df0a6f30655d0e4a4b515d14