-
Notifications
You must be signed in to change notification settings - Fork 41.2k
SimpleClientHttpRequest works different from previous SimpleBufferingClientHttpRequest. Cause of that now get: java.io.IOException: insufficient data written #39037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is a known change, see this section of the upgrade guide:
|
Hi, @bclozel Thanks for fast response. Before writing issue. Checked upgrade guide info and found your described solution it doesn't solve problem at least in my side. It was already tested as guide describe. new RestTemplateBuilder().requestFactory(() -> new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())) Problem still persists: java.io.IOException: insufficient data written. Only solution what I found was to calculate and preset correct content-lenght in headers before calling exchange. |
If your problem is similar to spring-cloud/spring-cloud-gateway#3154, it means you are using |
Yes it's so. I'm using it as proxy. public ResponseEntity post(final String postfix, final Map body, final HttpServletRequest req) {
|
I think you should move this to StackOverflow and get some advice there. Your implementation is probably problematic in many other ways (security headers or other sensitive headers, see spring-projects/spring-framework#21523). This is not a Spring bug and you should review your implementation. |
Since spring boot 3.2 there are changes for RestTemplate to use new SimpleClientHttpRequest
SimpleClientHttpRequest.executeInternal is different from before SimpleBufferingClientHttpRequest.executeInternal main problem is in logic
this.connection.setFixedLengthStreamingMode
In SimpleClientHttpRequest to setFixedLengthStreamingMode we take from headers content-lenght
In SimpleBufferingClientHttpRequest we used predefined buffer 1024.
Cause of this change always get: java.io.IOException: insufficient data written on post.
Is this bug ? Or expected change ?
The text was updated successfully, but these errors were encountered: