-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
The "Accept-Encoding" header is added twice when the " compression" option is enabled #1721
Comments
As far as I undertand you use httpclient. Could you confirm, please? I had made a test project with Spring 2.7.2 and Spring Cloud's OpenFeing and met the same issue:
I suppose that it is Apache HTTP Client's issue and does not relates with Spring or Feing. Update: I have made another simple feign application with httpclient:
|
This loop adds another header for each its value feign/core/src/main/java/feign/Request.java Line 247 in 307a322
|
* Fix issuse #1721 Accept-Encoding header is added twice * format core code
Hi,this fix may cause add feign/core/src/main/java/feign/Client.java Lines 184 to 196 in 7336c3e
|
Fix Isuue OpenFeign#1721 Content-Length may be added twice
Actually "Content-Length" will not be added because this key is in the restrictedHeaderSet of HttpURLConnection, @see sun.net.www.protocol.http.HttpURLConnection.isRestrictedHeader. |
In our case, We may set |
* Update Client.java Fix Isuue #1721 Content-Length may be added twice * format code * Add ClientTest unit tests * update license header * Update comment of ClientTest
* Fix issuse #1721 Accept-Encoding header is added twice * format core code
* Update Client.java Fix Isuue #1721 Content-Length may be added twice * format code * Add ClientTest unit tests * update license header * Update comment of ClientTest
* Fix issuse #1721 Accept-Encoding header is added twice * format core code
* Update Client.java Fix Isuue #1721 Content-Length may be added twice * format code * Add ClientTest unit tests * update license header * Update comment of ClientTest
feign-bom.version 11.9.1
spring-boot 2.7.2
When
feign.compression.response.enabled
is set totrue
in configuration, feign adds "Accept-Encoding" header(s) when sending request. Currently, two header fields are added (Accept-Encoding: gzip
andAccept-Encoding: deflate
).According to rfc7230 section 3.2.2
A sender MUST NOT generate multiple header fields with the same field
name in a message unless either the entire field value for that
header field is defined as a comma-separated list [i.e., #(values)]
or the header field is a well-known exception
Expected behaivour is to have one header field with the name "Accept-Encoding" and value "gzip, deflate".
ATM, having 2 "Accept-Encoding" headers causing remote side to "flatten" them and pick only one value randomly ("gzip" or "deflate")
The text was updated successfully, but these errors were encountered: