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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new b1634f831e29 CAMEL-26921: camel-oaipmh - remove the 
CamelOaimphIgnoreSSLWarnings producer header (#29843)
b1634f831e29 is described below

commit b1634f831e29a91b3c6089f1be8736d626278e15
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 13 16:39:48 2026 +0100

    CAMEL-26921: camel-oaipmh - remove the CamelOaimphIgnoreSSLWarnings 
producer header (#29843)
    
    The ignoreSSLWarnings endpoint option is now the only way to set the SSL
    setting of the HTTP client. The producer no longer reads the
    CamelOaimphIgnoreSSLWarnings header, and OAIPMHConstants.IGNORE_SSL_WARNINGS
    is removed.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../camel/oaipmh/component/OAIPMHProducer.java     |  4 +-
 .../oaipmh/component/model/OAIPMHConstants.java    |  1 -
 .../OAIPMHProducerHeadersPerExchangeTest.java      | 38 +----------
 .../OAIPMHProducerIgnoreSSLWarningsTest.java       | 76 ++++++++++++++++++++++
 .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc    | 14 ++--
 5 files changed, 88 insertions(+), 45 deletions(-)

diff --git 
a/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/OAIPMHProducer.java
 
b/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/OAIPMHProducer.java
index 7238e96572af..d4f5bd85c819 100644
--- 
a/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/OAIPMHProducer.java
+++ 
b/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/OAIPMHProducer.java
@@ -56,9 +56,9 @@ public class OAIPMHProducer extends DefaultProducer {
         }
         Message msg = exchange.getIn();
         overrideHarvesterConfigs(msg, harvester);
-        // the headers apply to this exchange only, the endpoint is shared by 
all exchanges
+        // the header applies to this exchange only, the endpoint is shared by 
all exchanges
         boolean onlyFirst = getBooleanHeader(msg, OAIPMHConstants.ONLY_FIRST, 
endpoint.isOnlyFirst());
-        if (getBooleanHeader(msg, OAIPMHConstants.IGNORE_SSL_WARNINGS, 
endpoint.isIgnoreSSLWarnings())) {
+        if (endpoint.isIgnoreSSLWarnings()) {
             harvester.getHttpClient().setIgnoreSSLWarnings(true);
         }
         List<String> synHarvest = harvester.synHarvest(onlyFirst);
diff --git 
a/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/model/OAIPMHConstants.java
 
b/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/model/OAIPMHConstants.java
index 92ca08b92e04..6df9b4186b10 100644
--- 
a/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/model/OAIPMHConstants.java
+++ 
b/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/model/OAIPMHConstants.java
@@ -29,7 +29,6 @@ public final class OAIPMHConstants {
     public static final String VERB = "CamelOaimphVerb";
     public static final String METADATA_PREFIX = "CamelOaimphMetadataPrefix";
     public static final String ONLY_FIRST = "CamelOaimphOnlyFirst";
-    public static final String IGNORE_SSL_WARNINGS = 
"CamelOaimphIgnoreSSLWarnings";
     public static final String UNTIL = "CamelOaimphUntil";
     public static final String FROM = "CamelOaimphFrom";
     public static final String SET = "CamelOaimphSet";
diff --git 
a/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/OAIPMHProducerHeadersPerExchangeTest.java
 
b/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/OAIPMHProducerHeadersPerExchangeTest.java
index ede6353d180f..884dd2db4bfb 100644
--- 
a/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/OAIPMHProducerHeadersPerExchangeTest.java
+++ 
b/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/OAIPMHProducerHeadersPerExchangeTest.java
@@ -18,9 +18,6 @@ package org.apache.camel.oaipmh;
 
 import java.util.List;
 
-import javax.net.ssl.SSLException;
-
-import org.apache.camel.CamelExecutionException;
 import org.apache.camel.oaipmh.component.OAIPMHEndpoint;
 import org.apache.camel.oaipmh.component.model.OAIPMHConstants;
 import org.apache.camel.oaipmh.utils.MockOaipmhServer;
@@ -31,13 +28,11 @@ import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertInstanceOf;
-import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
- * The CamelOaimphOnlyFirst and CamelOaimphIgnoreSSLWarnings headers apply to 
the exchange that has them, not to the
- * later exchanges sent to the same (shared) endpoint.
+ * The CamelOaimphOnlyFirst header applies to the exchange that has it, not to 
the later exchanges sent to the same
+ * (shared) endpoint.
  */
 class OAIPMHProducerHeadersPerExchangeTest extends CamelTestSupport {
 
@@ -80,33 +75,4 @@ class OAIPMHProducerHeadersPerExchangeTest extends 
CamelTestSupport {
         assertEquals(1, firstPage.size(), "an exchange without the header uses 
the endpoint option");
         assertTrue(context.getEndpoint(uri, 
OAIPMHEndpoint.class).isOnlyFirst());
     }
-
-    @Test
-    void ignoreSSLWarningsHeaderFalseOverridesTheEndpointOption() {
-        String uri = "oaipmh://localhost:" + mockOaipmhServer.getHttpsPort()
-                     + 
"/oai/request?ssl=true&verb=Identify&ignoreSSLWarnings=true";
-
-        CamelExecutionException e = assertThrows(CamelExecutionException.class,
-                () -> template.requestBodyAndHeader(uri, null, 
OAIPMHConstants.IGNORE_SSL_WARNINGS, false, List.class),
-                "a header of false rejects the self-signed certificate");
-        assertInstanceOf(SSLException.class, e.getCause(), "cause: " + 
e.getCause());
-
-        List<?> identify = template.requestBody(uri, null, List.class);
-        assertEquals(1, identify.size(), "an exchange without the header uses 
the endpoint option");
-        assertTrue(context.getEndpoint(uri, 
OAIPMHEndpoint.class).isIgnoreSSLWarnings());
-    }
-
-    @Test
-    void ignoreSSLWarningsHeaderAppliesToItsExchangeOnly() {
-        String uri = "oaipmh://localhost:" + mockOaipmhServer.getHttpsPort() + 
"/oai/request?ssl=true&verb=Identify";
-
-        List<?> identify = template.requestBodyAndHeader(uri, null, 
OAIPMHConstants.IGNORE_SSL_WARNINGS, true, List.class);
-        assertEquals(1, identify.size());
-
-        CamelExecutionException e = assertThrows(CamelExecutionException.class,
-                () -> template.requestBody(uri, null, List.class),
-                "the self-signed certificate is rejected for an exchange 
without the header");
-        assertInstanceOf(SSLException.class, e.getCause(), "cause: " + 
e.getCause());
-        assertFalse(context.getEndpoint(uri, 
OAIPMHEndpoint.class).isIgnoreSSLWarnings());
-    }
 }
diff --git 
a/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/OAIPMHProducerIgnoreSSLWarningsTest.java
 
b/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/OAIPMHProducerIgnoreSSLWarningsTest.java
new file mode 100644
index 000000000000..c9c280b54628
--- /dev/null
+++ 
b/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/OAIPMHProducerIgnoreSSLWarningsTest.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.oaipmh;
+
+import java.util.List;
+
+import javax.net.ssl.SSLException;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.oaipmh.utils.MockOaipmhServer;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * The ignoreSSLWarnings endpoint option is the only setting that makes the 
producer accept a self-signed certificate;
+ * the CamelOaimphIgnoreSSLWarnings message header is not read.
+ */
+class OAIPMHProducerIgnoreSSLWarningsTest extends CamelTestSupport {
+
+    private static final String IGNORE_SSL_WARNINGS_HEADER = 
"CamelOaimphIgnoreSSLWarnings";
+
+    private static MockOaipmhServer mockOaipmhServer;
+
+    @BeforeAll
+    static void startServer() {
+        mockOaipmhServer = MockOaipmhServer.create();
+        mockOaipmhServer.start();
+    }
+
+    @AfterAll
+    static void stopServer() {
+        mockOaipmhServer.stop();
+    }
+
+    @Test
+    void ignoreSSLWarningsHeaderDoesNotChangeTheCertificateCheck() {
+        String uri = "oaipmh://localhost:" + mockOaipmhServer.getHttpsPort() + 
"/oai/request?ssl=true&verb=Identify";
+
+        CamelExecutionException e = assertThrows(CamelExecutionException.class,
+                () -> template.requestBodyAndHeader(uri, null, 
IGNORE_SSL_WARNINGS_HEADER, true, List.class),
+                "the self-signed certificate is rejected when the endpoint 
option is not set");
+        assertInstanceOf(SSLException.class, e.getCause(), "cause: " + 
e.getCause());
+    }
+
+    @Test
+    void ignoreSSLWarningsEndpointOptionAcceptsTheSelfSignedCertificate() {
+        String uri = "oaipmh://localhost:" + mockOaipmhServer.getHttpsPort()
+                     + 
"/oai/request?ssl=true&verb=Identify&ignoreSSLWarnings=true";
+
+        List<?> identify = template.requestBody(uri, null, List.class);
+        assertEquals(1, identify.size());
+
+        List<?> identifyWithHeader = template.requestBodyAndHeader(uri, null, 
IGNORE_SSL_WARNINGS_HEADER, false, List.class);
+        assertEquals(1, identifyWithHeader.size(), "the header does not change 
the endpoint option");
+    }
+}
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 9580c105f0ef..a419236e5e35 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -1525,13 +1525,15 @@ way as the `camel.uri` attribute, which shows the 
endpoint URI as `Endpoint.toSt
 
 Dashboards or queries that use the old values may need a change.
 
-=== camel-oaipmh - the CamelOaimphOnlyFirst and CamelOaimphIgnoreSSLWarnings 
headers apply to their message only
+=== camel-oaipmh - the CamelOaimphOnlyFirst header applies to its message 
only, and the CamelOaimphIgnoreSSLWarnings header is removed
 
-The `CamelOaimphOnlyFirst` and `CamelOaimphIgnoreSSLWarnings` headers now 
apply only to the message that has them.
-Before, the producer wrote them onto the endpoint, so after one message with 
`CamelOaimphOnlyFirst=true` every later
-message sent to that endpoint returned only the first page, and after one 
message with
-`CamelOaimphIgnoreSSLWarnings=true` every later message accepted a self-signed 
certificate. A message without the
-header uses the `onlyFirst` and `ignoreSSLWarnings` options of the endpoint.
+The `CamelOaimphOnlyFirst` header now applies only to the message that has it. 
Before, the producer wrote it onto the
+endpoint, so after one message with `CamelOaimphOnlyFirst=true` every later 
message sent to that endpoint returned only
+the first page. A message without the header uses the `onlyFirst` option of 
the endpoint.
+
+The producer no longer reads the `CamelOaimphIgnoreSSLWarnings` header, and 
the `OAIPMHConstants.IGNORE_SSL_WARNINGS`
+constant is removed. Use the `ignoreSSLWarnings` option of the endpoint 
instead; when only some repositories need it,
+send to them through an endpoint URI that sets the option.
 
 === camel-clickhouse - a query in a binary format returns a byte[] body
 

Reply via email to