Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalArgumentException: Deflate Content-Encoding is not supported by feign-hc5 #2460

Open
beifuyiqiedeqilin opened this issue Jun 27, 2024 · 2 comments
Labels
help wanted Issues we need help with tackling waiting for feedback Issues waiting for a response from either to the author or other maintainers

Comments

@beifuyiqiedeqilin
Copy link

When we upgraded to spring-boot-dependencies-3.3.0, we also upgrade the spring-cloud according to https://spring.io/blog/2024/05/31/spring-cloud-2023-0-2-oss-and-2022-0-7-enterprise-have-been-released, Then my service met error
"Caused by: java.lang.IllegalArgumentException: Deflate Content-Encoding is not supported by feign-hc5"

Here is some finding of troubleshooting:

As we set spring.cloud.openfeign.compression.request.enabled=true, so the FeignContentGzipEncodingInterceptor(spring-cloud-openfeign-core-4.1.2) is enabled too

public class FeignContentGzipEncodingInterceptor extends BaseRequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {
        if (requiresCompression(template)) {
		addHeader(template, HttpEncoding.CONTENT_ENCODING_HEADER, HttpEncoding.GZIP_ENCODING,
					HttpEncoding.DEFLATE_ENCODING);
	}
    }
}

If the compression condition matched, it will add fixed header(Content-Encoding: gzip,deflate), but after the PR #2247, it will throw IllegalArgumentException once 'deflate' exists in header 'Content-Encoding'

if (headerName.equalsIgnoreCase(Util.CONTENT_ENCODING)) {
        isGzip = headerEntry.getValue().stream().anyMatch(Util.ENCODING_GZIP::equalsIgnoreCase);
        boolean isDeflate =
            headerEntry.getValue().stream().anyMatch(Util.ENCODING_DEFLATE::equalsIgnoreCase);
        if (isDeflate) {
          // DeflateCompressingEntity not available in hc5 yet
          throw new IllegalArgumentException(
              "Deflate Content-Encoding is not supported by feign-hc5");
        }
      }

I think it is incompatible change, @fbus or term, Please take a look on it

@kdavisk6
Copy link
Member

You've done quite a bit of work here and #2247 was added almost a year ago. Care to try to submit a pull-request and submit a fix for this?

@kdavisk6 kdavisk6 added waiting for feedback Issues waiting for a response from either to the author or other maintainers help wanted Issues we need help with tackling labels Sep 11, 2024
@beifuyiqiedeqilin
Copy link
Author

You've done quite a bit of work here and #2247 was added almost a year ago. Care to try to submit a pull-request and submit a fix for this?

Okay, I'll try to do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues we need help with tackling waiting for feedback Issues waiting for a response from either to the author or other maintainers
Projects
None yet
Development

No branches or pull requests

2 participants