@@ -234,24 +234,30 @@ public record Req(String url, Optional<String> body, List<HttpHeader> headerList
234234 */
235235 private HttpClient getHttpClient (BaseExecutionContext ctx ) {
236236 if (this .httpClient == null ) {
237- // Vertx only uses ssl options when https
238- var options = new HttpClientOptions ().setSsl (true ).setTrustAll (true ).setVerifyHost (false );
237+ synchronized (this ) {
238+ if (this .httpClient == null ) {
239+ // SSL options (trustAll, verifyHost) are set at client level but only applied per-request
240+ // when the URL scheme is HTTPS. Vertx's RequestOptions.setAbsoluteURI() overrides the client
241+ // SSL setting based on the actual URL scheme, so HTTP requests are not affected.
242+ var options = new HttpClientOptions ().setSsl (true ).setTrustAll (true ).setVerifyHost (false );
239243
240- if (configuration .isUseSystemProxy ()) {
241- Configuration config = ctx .getComponent (Configuration .class );
242- try {
243- options .setProxyOptions (VertxProxyOptionsUtils .buildProxyOptions (config ));
244- } catch (IllegalStateException e ) {
245- ctx
246- .withLogger (log )
247- .warn (
248- "CalloutHttp requires a system proxy to be defined but some configurations are missing or not well defined: {}. Ignoring proxy" ,
249- e .getMessage ()
250- );
244+ if (configuration .isUseSystemProxy ()) {
245+ Configuration config = ctx .getComponent (Configuration .class );
246+ try {
247+ options .setProxyOptions (VertxProxyOptionsUtils .buildProxyOptions (config ));
248+ } catch (IllegalStateException e ) {
249+ ctx
250+ .withLogger (log )
251+ .warn (
252+ "CalloutHttp requires a system proxy to be defined but some configurations are missing or not well defined: {}. Ignoring proxy" ,
253+ e .getMessage ()
254+ );
255+ }
256+ }
257+ var vertx = ctx .getComponent (Vertx .class );
258+ this .httpClient = vertx .createHttpClient (options );
251259 }
252260 }
253- var vertx = ctx .getComponent (Vertx .class );
254- this .httpClient = vertx .createHttpClient (options );
255261 }
256262 return this .httpClient ;
257263 }
0 commit comments