feign icon indicating copy to clipboard operation
feign copied to clipboard

GZIP body decompression before decoding through logging side effect

Open OlgaMaciaszek opened this issue 3 years ago • 3 comments

While upgrading Feign in SC OpenFeign to versions: 11.1, 11.2 (btw., I can't see this tag in repo, but the artifact is present in mvn), I have stumbled upon an issue:

When GZIP is set as CONTENT-ENCODING, the response body is now being wrapped with GZIPInputStream. When logging is not enabled, a response this GZIPInputStream body is then passed to decoders for further handling.

However, when logging is enabled, the GZIP body is decompressed here (through calling read(byte[] buf, int off, int len) from java.util.zip.GZIPInputStream.java) and then this decompressed byte array is set as response body here.

OlgaMaciaszek avatar May 10 '21 15:05 OlgaMaciaszek

While upgrading Feign in SC OpenFeign to versions: 11.1, 11.2 (btw., I can't see this tag in repo, but the artifact is present in mvn)

This is odd I can see it fine: https://github.com/OpenFeign/feign/releases/tag/11.2

velo avatar May 10 '21 18:05 velo

Right, my bad: the tag is there; it's the release notes that are missing; sorry for the confusion.

OlgaMaciaszek avatar May 11 '21 09:05 OlgaMaciaszek

This side-effect has come up a few times. I wonder if we need to reconsider this approach, or at least make it clear that logging will read the response and potentially re-wrap.

kdavisk6 avatar May 21 '21 17:05 kdavisk6