Skip to content

Http: honor Content-Encoding and expose decodeInputStream - #114

Closed
anjeshshrestha wants to merge 1 commit into
darkbot-reloaded:masterfrom
anjeshshrestha:gzip-response-decoding
Closed

anjeshshrestha wants to merge 1 commit into
darkbot-reloaded:masterfrom
anjeshshrestha:gzip-response-decoding

Conversation

@anjeshshrestha

Copy link
Copy Markdown
Contributor
  • Use readNBytes for the gzip magic check; a plain read() may return a single byte on a partial network read and skip decompression
  • Decompress when Content-Encoding says gzip or deflate, not only when the gzip magic bytes are present
  • Add static Http.decodeInputStream(HttpURLConnection) so callers that work with getConnection() directly (e.g. to inspect the final URL) get the same decoding
  • Leave empty bodies untouched instead of throwing EOFException

- Use readNBytes for the gzip magic check; a plain read() may return a
  single byte on a partial network read and skip decompression
- Decompress when Content-Encoding says gzip or deflate, not only when
  the gzip magic bytes are present
- Add static Http.decodeInputStream(HttpURLConnection) so callers that
  work with getConnection() directly (e.g. to inspect the final URL)
  get the same decoding
- Leave empty bodies untouched instead of throwing EOFException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant