ffang commented on code in PR #3673:
URL: https://github.com/apache/cxf/pull/3673#discussion_r4498439226


##########
rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java:
##########
@@ -411,7 +521,11 @@ protected void setupConnection(Message message, Address 
address, HTTPClientPolic
         RefCount<HttpClient> cl = clientRef;
         if (cl == null) {
             int ctimeout = determineConnectionTimeout(message, csPolicy);
-            ProxySelector ps = new ProxyFactoryProxySelector(proxyFactory, 
csPolicy);
+            // the client keeps copies of the settings it is built from, so 
that it is not
+            // affected by later changes to the settings of this, or any 
other, conduit
+            final HTTPClientPolicy clientPolicy = copyOf(csPolicy);

Review Comment:
   Thanks @reta. I added `TLSClientParameters.copy()` with a test, and the 
conduit now uses it (05ae30fc43). It copies the arrays, the lists and the 
cipher suites filter, and shares the objects they hold. The conduit then clears 
the certificate constraints in its copy, as the client isn't built from them.
   
   I kept `copyOf(HTTPClientPolicy, ...)` in the conduit for two reasons:
   - `HTTPClientPolicy` is generated by xjc from `http-conf.xsd`, so a `copy()` 
would need an xjc plugin or a hand-written method in generated code.
   - The conduit's copy is deliberately not a full copy. It holds only the 
settings the client is built from, with the connection timeout and version in 
effect for the request (`Message.CONNECTION_TIMEOUT`, `FORCE_HTTP_VERSION`) 
rather than the policy's own values, following @coheigea's review (67c01db170). 
A general `HTTPClientPolicy.copy()` wouldn't be the right key here.



-- 
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]

Reply via email to