fuel icon indicating copy to clipboard operation
fuel copied to clipboard

204 + Gzip leads to EOFException

Open F43nd1r opened this issue 5 years ago • 3 comments

Bug Report

Description

If a server returns a 204 No Content including a Content-Encoding gzip header, Fuel will throw an EOFException, because it tries to read a gzip header from an empty body.

To Reproduce

Steps to reproduce the behavior:

Fuel.get("https://faendir.com/test/gzip-204.php").responseString()

Expected behavior

I would expect Fuel to return an empty string here.

F43nd1r avatar Oct 15 '19 14:10 F43nd1r

FWIW, this is non standard behaviour, but has been reported in other agents like here as well.

We can probably apply the same fix: see if there is content to decode and ignore if there isn't any.

SleeplessByte avatar Oct 15 '19 15:10 SleeplessByte

this is non standard behaviour

True, but handling it gracefully would be nice anyways.

We can probably apply the same fix: see if there is content to decode and ignore if there isn't any.

Sounds good.

F43nd1r avatar Oct 15 '19 15:10 F43nd1r

Oh I just meant to explain why it currently blows up. I followed the RFC very closely to implement everything. We then ran into non standard things android already does so no worries :)

SleeplessByte avatar Oct 15 '19 19:10 SleeplessByte