ContentCachingResponseWrapper.setHeader does not handle null value properly. #34460
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
First reported against Eclipse Jetty at ...
The stacktrace looks like this ...
What is happening is that the
HttpServletResponse.setHeader("Content-Length", null)
method is being called.The
ContentCachingResponseWrapper.setHeader(String, String)
sees theContent-Length
header and then blindly tries parse the value.spring-framework/spring-web/src/main/java/org/springframework/web/util/ContentCachingResponseWrapper.java
Lines 161 to 168 in b932df6
The servlet spec has always treated a null in the value parameter for setHeader as a remove of that header.
At a minimum, this code should be changed to pass-through any null value and do no further processing of the header.
But I suspect you'll want to null out your tracking of the content-length header as well.
The text was updated successfully, but these errors were encountered: