This is an automated email from the ASF dual-hosted git repository. reta pushed a commit to branch 3.6.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git
commit e5106ca398aee0860d8fe69f0df11692e5c3ad2b Author: Jim Ma <e...@apache.org> AuthorDate: Tue Sep 26 11:17:14 2023 +0800 [CXF-8935]:Add doPrivileged block to httpclient.sendAsync() in HttpClientHTTPConduit (cherry picked from commit 7e68c884c61f30199b7925c2f9d4020c3a5d6f1d) --- .../cxf/transport/http/HttpClientHTTPConduit.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java index d99309b3ca..86284ba093 100644 --- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java +++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java @@ -548,8 +548,21 @@ public class HttpClientHTTPConduit extends URLConnectionHTTPConduit { final BodyHandler<InputStream> handler = BodyHandlers.ofInputStream(); - - future = cl.sendAsync(request, handler); + if (System.getSecurityManager() != null) { + try { + future = AccessController.doPrivileged( + new PrivilegedExceptionAction<CompletableFuture<HttpResponse<InputStream>>>() { + @Override + public CompletableFuture<HttpResponse<InputStream>> run() throws IOException { + return cl.sendAsync(request, handler); + } + }); + } catch (PrivilegedActionException e) { + throw new RuntimeException(e); + } + } else { + future = cl.sendAsync(request, handler); + } future.exceptionally(ex -> { if (pout != null) { synchronized (pout) {