You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2023/09/06 18:43:12 UTC
[camel] branch main updated: CAMEL-19843: HTTP/2 pseudo-headers such as :status should not be propagated from CXF message to Camel message
This is an automated email from the ASF dual-hosted git repository.
ppalaga 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 b7f21f2f3cf CAMEL-19843: HTTP/2 pseudo-headers such as :status should not be propagated from CXF message to Camel message
b7f21f2f3cf is described below
commit b7f21f2f3cf3ef5f1884d74b54632781ea1ecc56
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Sep 6 19:19:47 2023 +0200
CAMEL-19843: HTTP/2 pseudo-headers such as :status should not be
propagated from CXF message to Camel message
---
.../apache/camel/component/cxf/jaxws/DefaultCxfBinding.java | 3 +++
.../camel/component/cxf/jaxws/CxfProducerRouterTest.java | 13 +++++++++++++
2 files changed, 16 insertions(+)
diff --git a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/DefaultCxfBinding.java b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/DefaultCxfBinding.java
index 13eb2c68b85..f9d35445251 100644
--- a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/DefaultCxfBinding.java
+++ b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/DefaultCxfBinding.java
@@ -674,6 +674,9 @@ public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware
// SOAPAction header may contain quoted value. Remove the quotes here.
soapAction = StringHelper.removeLeadingAndEndingQuotes(soapAction);
camelHeaders.put(SoapBindingConstants.SOAP_ACTION, soapAction);
+ } else if (entry.getKey().startsWith(":")) {
+ /* Ignore HTTP/2 pseudo headers such as :status */
+ continue;
} else {
LOG.trace("Populate header from CXF header={} value={}",
entry.getKey(), entry.getValue());
diff --git a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfProducerRouterTest.java b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfProducerRouterTest.java
index 544b4c348ca..82f9d6dd1e2 100644
--- a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfProducerRouterTest.java
+++ b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfProducerRouterTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.cxf.jaxws;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
@@ -152,6 +153,18 @@ public class CxfProducerRouterTest extends CamelTestSupport {
}
+ @Test
+ public void testIgnorePseudoHeaders() throws Exception {
+ Exchange senderExchange = new DefaultExchange(context, ExchangePattern.InOut);
+ senderExchange.getIn().setBody(REQUEST_MESSAGE);
+ Exchange exchange = template.send("direct:EndpointB", senderExchange);
+
+ org.apache.camel.Message out = exchange.getMessage();
+ final List<String> pseudoHeaders
+ = out.getHeaders().keySet().stream().filter(key -> key.startsWith(":")).collect(Collectors.toList());
+ assertTrue(pseudoHeaders.isEmpty(), "Pseudo-headers such as :status should be filtered out; found: " + pseudoHeaders);
+ }
+
@Test
public void testInvokingSimpleServerWithPayLoadDataFormat() throws Exception {
Exchange senderExchange = new DefaultExchange(context, ExchangePattern.InOut);