Andrea Cosentino created CAMEL-25133:
----------------------------------------
Summary: camel-http-common - a non-chunked response over 2 GiB
gets a wrong Content-Length
Key: CAMEL-25133
URL: https://issues.apache.org/jira/browse/CAMEL-25133
Project: Camel
Issue Type: Bug
Components: camel-http-common
Reporter: Andrea Cosentino
DefaultHttpBinding.doWriteDirectResponse sizes a non-chunked response with
{code}int len = copyStream(is, stream, response.getBufferSize());
response.setContentLength(len);{code}
IOHelper.copy returns an int. Above 2 GiB it used to wrap to a negative value,
and since CAMEL-25023 it is clamped to Integer.MAX_VALUE. Either way the
Content-Length header is wrong for such a response.
Suggested fix: take the length as a long from the CachedOutputStream the body
was copied into, and call HttpServletResponse.setContentLengthLong (Servlet
3.1+).
Raised in the review of https://github.com/apache/camel/pull/26892
(CAMEL-25023).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)