This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.22.x by this push:
     new e4b167b88316 [backport camel-4.22.x] CAMEL-24815: camel-opensearch - 
honour socketTimeout without SSL and scope basic auth to all hosts (#26711)
e4b167b88316 is described below

commit e4b167b8831607788735cc9a61bc33205880bb05
Author: Guillaume Nodet <[email protected]>
AuthorDate: Mon Sep 21 23:37:55 2026 +0200

    [backport camel-4.22.x] CAMEL-24815: camel-opensearch - honour 
socketTimeout without SSL and scope basic auth to all hosts (#26711)
---
 .../org/apache/camel/component/opensearch/OpensearchProducer.java  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchProducer.java
 
b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchProducer.java
index c25efe389fa2..f90f6314a1ca 100644
--- 
a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchProducer.java
+++ 
b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchProducer.java
@@ -486,11 +486,14 @@ class OpensearchProducer extends DefaultAsyncProducer {
         final RestClientBuilder builder = 
RestClient.builder(configuration.getHostAddressesList().toArray(new 
HttpHost[0]));
 
         builder.setRequestConfigCallback(requestConfigBuilder -> 
requestConfigBuilder
-                
.setConnectTimeout(Timeout.of(Duration.ofMillis(configuration.getConnectionTimeout()))));
+                
.setConnectTimeout(Timeout.of(Duration.ofMillis(configuration.getConnectionTimeout())))
+                // apply the socket/read timeout for both plain-HTTP and SSL 
connections, not only when SSL is enabled
+                
.setResponseTimeout(Timeout.of(Duration.ofMillis(configuration.getSocketTimeout()))));
         builder.setHttpClientConfigCallback(httpClientBuilder -> {
             if (ObjectHelper.isNotEmpty(configuration.getUser()) && 
ObjectHelper.isNotEmpty(configuration.getPassword())) {
                 final BasicCredentialsProvider credentialsProvider = new 
BasicCredentialsProvider();
-                credentialsProvider.setCredentials(new 
AuthScope(configuration.getHostAddressesList().get(0)),
+                // match-all AuthScope so basic auth is sent to every node, 
not only the first configured host
+                credentialsProvider.setCredentials(new AuthScope(null, null, 
-1, null, null),
                         new 
UsernamePasswordCredentials(configuration.getUser(), 
configuration.getPassword().toCharArray()));
                 
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
             }

Reply via email to