reta commented on code in PR #3701:
URL: https://github.com/apache/cxf/pull/3701#discussion_r4530724016
##########
rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java:
##########
@@ -1161,22 +1161,21 @@ public CompletableFuture<HttpResponse<InputStream>>
run() throws IOException {
future = cl.sendAsync(request, handler);
}
future.exceptionally(ex -> {
- // Record the failure on the message so the close() invoked
below
- // does not treat this as an un-sent request and resend it: the
- // shared WrappedOutputStream#close() already skips
- // handleHeadersTrustCaching() once outMessage carries an
Exception
- // (CXF-9250).
- outMessage.setContent(Exception.class,
- ex instanceof Exception ? (Exception) ex : new
IOException(ex));
- if (pout != null) {
- synchronized (pout) {
- pout.notifyAll();
+ // Only release a writer waiting for the connection or blocked
on the body. The
+ // caller still closes the stream, and the failure is reported
from there, by the
+ // response handling getting it from the future. Closing the
whole stream here
+ // would send a request without a body again, and recording
the failure on the
+ // message would keep the caller's close() from reporting it.
+ final OutputStream out = pout;
+ if (out != null) {
+ synchronized (out) {
+ out.notifyAll();
+ }
+ try {
+ out.close();
Review Comment:
Post-close, should we set pout to `null` so it won't attempted to be closed
again? (by HttpClientWrappedOutputStream::close)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]