Repository navigation
[JENKINS-76353] Ignore Content-Encoding: none in responses - #347
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
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.
Fixes #336 (JENKINS-76353).
Since Apache HttpClient 5.6 (shipped in
apache-httpcomponents-client-5-api5.6-x),ContentCompressionExecfails the request when the response declares a content coding it has no decoder for (apache/httpcomponents-client#698). Some servers, such as the Dynatrace installer API in the issue, sendContent-Encoding: nonefor uncompressed content, sohttpRequestfails withClientProtocolException: Unsupported Content-Encoding: none.This change registers a small exec chain handler right after
ChainElement.COMPRESS. When the response entity declaresContent-Encoding: none, the handler wraps the entity so that it reports no content encoding, and the compression stage passes the body through unchanged. Gzip, deflate and other real codings, as well as unknown codings other thannone, behave as before. This is the workaround that the HttpClient maintainer suggests in the linked upstream PR. The response headers that the step exposes are not modified.Testing done
Added
HttpRequestStepTest#contentEncodingNoneIsIgnored, which serves a plain-text response withContent-Encoding: noneand asserts that the build succeeds and the body is read.With the pom's current BOM the test classpath has HttpClient 5.5, which ignores unknown codings, so the test passes there with or without the fix. To reproduce the reported failure, the test ran against
apache-httpcomponents-client-5-api5.6-183.ve5a_8a_b_e71e59 (the version from the issue) with-Djenkins.version=2.492.3:Tests run: 1, Failures: 1, build log showsUnsupported Content-Encoding: none.Tests run: 1, Failures: 0.mvn verifywith the unmodified pom (all tests and SpotBugs) passes.Submitter checklist