[
https://issues.apache.org/jira/browse/CXF-8914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17762491#comment-17762491
]
Daniel Kulp commented on CXF-8914:
----------------------------------
Another option (and possibly the better option) is to set the ChunkingThreshold
to something fairly high, but reasonable. If you know all your messages are
under 10M, set it to 10M.
With chunking completely turned off, the entire request message needs to be
buffered to determine the content length prior to sending the data. The
URLConnection does this automatically if chunking is turned off. However, one
problem with this is that if you accidentally send a really large message, it
will consume all the memory and then crash.
If you keep chunking turned on, but set to a fairly high threshold, then as
long as the messages are below the threshold, it can then set the
Content-Length and send the message. This should work even with the newer
conduit. However, once the threshold is reached, it "flushes" the buffer and
starts streaming. Thus, it won't end up consuming all the memory. If the
other server doesn't understand the chunking, it may not work and would
generate an error, but at least your client is still running.
> No content-length header after upgrade CXF from 3.5.6 to 3.6.1
> --------------------------------------------------------------
>
> Key: CXF-8914
> URL: https://issues.apache.org/jira/browse/CXF-8914
> Project: CXF
> Issue Type: Bug
> Affects Versions: 3.6.1
> Environment: SpringBoot 2.7.13
> Reporter: Stephan Näcker
> Priority: Major
> Fix For: 3.6.2, 4.0.3
>
>
> After updating the CXF dependency in our application from 3.5.6 to 3.6.1 it
> does not add a content-length header anymore, when doing a multipart request
> for a file upload.
> I didn't find any information, how to let CXF set the header. Is it just
> dependent of chunking?
> Actually the application sets "allow chunking" to false. But I'm not sure,
> how I can test, if this really works.
> Thanks in advance for your help.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)