Skip to content

Normalize JDK client decompression header checks - #37386

Merged
bclozel merged 2 commits into
spring-projects:7.0.xfrom
zemiles:fix/jdk-client-compression-header-case
Oct 22, 2026
Merged

bclozel merged 2 commits into
spring-projects:7.0.xfrom
zemiles:fix/jdk-client-compression-header-case

Conversation

@zemiles

@zemiles zemiles commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #37385.

JdkClientHttpRequestFactory decompresses gzip and deflate responses
case-insensitively, but retains Content-Encoding and the compressed
Content-Length when the encoding value contains uppercase characters.

Normalize the header cleanup comparison with Locale.ROOT so these
headers are consistently removed.

Extend the existing POST and HEAD tests to cover lowercase, uppercase,
and mixed-case gzip and deflate values. Preserve the original encoding
case in the mock server responses.

Validation:

  • Eight uppercase/mixed-case regression cases failed before the fix.
  • All 25 JdkClientHttpRequestFactoryTests cases pass after the fix.
  • spring-web:check, including Checkstyle, passes on Windows with JDK 25.
    The test JVM used --enable-native-access=ALL-UNNAMED to address the
    Windows/Netty shared-buffer limitation.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 3, 2026
@zemiles

zemiles commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Hi, just following up on this PR. I'd appreciate a review when you have time, and I'm happy to address any feedback. Thank you!

@bclozel bclozel self-assigned this Oct 22, 2026
@bclozel bclozel added in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 22, 2026
@bclozel
bclozel changed the base branch from main to 7.0.x October 22, 2026 08:47
zemiles and others added 2 commits October 22, 2026 10:52
The JDK client decodes gzip and deflate responses case-insensitively,
but its response header cleanup compares the original encoding value.
This leaves Content-Encoding and the compressed Content-Length
attached to decoded responses for uppercase or mixed-case values.

Normalize the cleanup comparison using Locale.ROOT and extend the
POST and HEAD regression tests to cover encoding case variations.
Preserve the encoding case in mock responses to reproduce the bug.

Closes spring-projectsgh-37385

Signed-off-by: An Seunghyeon <abeb3@naver.com>
Signed-off-by: 안승현 <abeb3@naver.com>
Restore the original compression tests and only add mixed-case
values to the HEAD request test, which exercises the header cleanup.
Wrap the lowercase check to match the code style.

See spring-projectsgh-37385

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
@bclozel
bclozel force-pushed the fix/jdk-client-compression-header-case branch from 49b0a89 to 3d5aaf3 Compare October 22, 2026 09:03
@bclozel bclozel added this to the 7.0.11 milestone Oct 22, 2026
@bclozel
bclozel merged commit 3d5aaf3 into spring-projects:7.0.x Oct 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JdkClientHttpRequestFactory retains compression headers for mixed-case Content-Encoding values

3 participants