Skip to content

Add Missing OnCommitedResponseWrapper Header Overrides#18800

Merged
rwinch merged 3 commits intospring-projects:mainfrom
rwinch:spring-framework-gh-36381-setHeader
Feb 25, 2026
Merged

Add Missing OnCommitedResponseWrapper Header Overrides#18800
rwinch merged 3 commits intospring-projects:mainfrom
rwinch:spring-framework-gh-36381-setHeader

Conversation

@rwinch
Copy link
Member

@rwinch rwinch commented Feb 25, 2026

Forward port of gh-18798

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 self-assigned this Feb 25, 2026
@rwinch rwinch added in: web An issue in web modules (web, webmvc) type: bug A general bug status: forward-port An issue tracking the forward-port of a change made in an earlier branch labels Feb 25, 2026
@rwinch rwinch added this to the 7.1.0-M3 milestone Feb 25, 2026
@rwinch rwinch merged commit d3474e7 into spring-projects:main Feb 25, 2026
7 checks passed
@rwinch rwinch deleted the spring-framework-gh-36381-setHeader 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) status: forward-port An issue tracking the forward-port of a change made in an earlier branch type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant