Skip to content

fix: handle empty Gzip response bodies#388

Merged
florent37 merged 1 commit intoopenflocon:mainfrom
Karambar:fix/exception-gzip-empty-body
Nov 18, 2025
Merged

fix: handle empty Gzip response bodies#388
florent37 merged 1 commit intoopenflocon:mainfrom
Karambar:fix/exception-gzip-empty-body

Conversation

@Karambar
Copy link
Copy Markdown
Contributor

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.

- 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.
@florent37
Copy link
Copy Markdown
Contributor

florent37 commented Nov 18, 2025

ah yes thanks a lot @Karambar ❤️ I never faced this use case, I'm merging it and deploy a new version

@florent37 florent37 merged commit eb198c2 into openflocon:main Nov 18, 2025
@florent37
Copy link
Copy Markdown
Contributor

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.

2 participants