Transparent GZIP decompression only returns single line of document from response.
See original GitHub issueI’m having an issue with transparent GZIP decompression.
I’m not sure if this is the webserver returning a weird response, I’m also not sure what kind of information you need from me in this case.
Basically, If I let OkHttp handle decompression transparently, it only returns a single line of the document from the response. However, when I handle decompression myself using a GZIPInputStream, and read from it using a BufferedReader from body().byteStream()
, I get the entire document. This way also gives me connection leaked warnings in my Logcat output, even though I’m calling body().close()
after every request. (Even if I don’t use the response body).
Please let me know if you need any more information, I would be happy to provide.
P.S. I’m working on adding code and a test case to this post instead of using links. Just wanted to get it up to get initial responses on whether I was just crazy or not. 😃
EDIT
After building a simple test case, using Eclipse/Java environment (instead of Android libraries). This issue is not present. In both cases, the entire document is fetched correctly. This issue only appears in the android app and for the specific server I am sending the request to, Response headers will be below…
Dependencies under gradle file.
dependencies { … compile ‘com.android.support:appcompat-v7:23.2.1’ compile ‘com.android.support:design:23.2.1’ compile ‘com.squareup.okhttp3:okhttp:3.2.0’ compile ‘com.android.support:support-v4:23.2.1’ }
Response headers from the site:
Cache-Control: private Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding Server: Microsoft-IIS/7.5 Set-Cookie: ASP.NET_SessionId=<omitted>; path=/; HttpOnly X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET Date: Sat, 19 Mar 2016 03:17:25 GMT OkHttp-Sent-Millis: 1458358005672 OkHttp-Received-Millis: 1458358005742
Again, this only happens in the android app, and only when sending the request to this specific website. If I send the request to google.com or facebook.com, it succeeds. But for some reason, everything works fine when not using the android libraries.
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (6 by maintainers)
Top GitHub Comments
And if you don’t trim?
All good. Truncating logs are annoying. You might be interested in this: https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor