fix: handle empty Gzip response bodies#388
Merged
florent37 merged 1 commit intoopenflocon:mainfrom Nov 18, 2025
Merged
Conversation
- Don't try to read the buffer if the size is empty, as it will throw an EOFException. Throwing this exception can cause the underlying app to crash or misbehave due to a parsing issue in a debugging tool, which is unexpected. - Quickly refactor the Gzip detection code to improve readability.
Contributor
|
ah yes thanks a lot @Karambar ❤️ I never faced this use case, I'm merging it and deploy a new version |
florent37
approved these changes
Nov 18, 2025
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While testing Flocon as a potential replacement for Flipper at my company, I noticed that the OkHttpInterceptor is throwing an EOFException when trying to parse an empty Gzip response.
Although this behavior may seem unusual, it can occur when an API returns a 204 status code and the server is configured to always return Gzip responses.
Flipper did not throw an exception in this scenario; it simply ignored the body if the buffer size was zero.
This pull request aims to implement the same behavior in Flocon. However, do not hesitate to challenge this change and suggest alternatives.
Summary of Changes:
Don't try to read the buffer if the size is empty, as it will throw an EOFException. Throwing this exception can cause the underlying app to crash or misbehave because of an issue in the debugging library, which is unexpected.
Quickly refactor the Gzip detection code to improve readability.
Note
I could not find the contribution guidelines. Feedback is welcomed if anything doesn't suit your requirements.