Skip to content

Add Missing OnCommitedResponseWrapper Header Overrides#18798

Merged
rwinch merged 1 commit intospring-projects:6.5.xfrom
rwinch:6.5.x-gh-18795-responsewrapper-header-overrides
Feb 25, 2026
Merged

Add Missing OnCommitedResponseWrapper Header Overrides#18798
rwinch merged 1 commit intospring-projects:6.5.xfrom
rwinch:6.5.x-gh-18795-responsewrapper-header-overrides

Conversation

@rwinch
Copy link
Copy Markdown
Member

@rwinch rwinch commented Feb 25, 2026

Spring Security's OnCommitedResponseWrapper does not override the setHeader, setIntHeader, addIntHeader
methods. This means that if the Content-Length response header is specified using any of those methods then
the response body length is not tracked and can be committed before the response headers are written.

Spring Security should override the missing methods and track Content-Length as is already done for addHeader.

This issue is the underlying problem for spring-projects/spring-framework#36381

Closes gh-18797

Spring Security's `OnCommitedResponseWrapper` does not override the `setHeader`, `setIntHeader`, `addIntHeader`
methods. This means that if the `Content-Length` response header is specified using any of those methods then
the response body length is not tracked and can be committed before the response headers are written.

Spring Security should override the missing methods and track `Content-Length` as is already done for `addHeader`.

This issue is the underlying problem for spring-projects/spring-framework#36381

Closes spring-projectsgh-18797
@rwinch rwinch added this to the 6.5.9 milestone Feb 25, 2026
@rwinch rwinch self-assigned this Feb 25, 2026
@rwinch rwinch added in: web An issue in web modules (web, webmvc) type: bug A general bug labels Feb 25, 2026
@rwinch rwinch changed the base branch from main to 6.5.x February 25, 2026 01:55
@rwinch rwinch merged commit 522c48b into spring-projects:6.5.x Feb 25, 2026
7 checks passed
@rwinch rwinch deleted the 6.5.x-gh-18795-responsewrapper-header-overrides branch February 25, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web An issue in web modules (web, webmvc) type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing OnCommitedResponseWrapper header overrides

1 participant