Skip to content

Commit 4aab786

Browse files
committed
CAMEL-22353: camel-undertow - Skip headers which has invalid chars in names.
1 parent 3588e02 commit 4aab786

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowHeaderFilterStrategy.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,22 @@
1616
*/
1717
package org.apache.camel.component.undertow;
1818

19-
import org.apache.camel.support.DefaultHeaderFilterStrategy;
20-
import org.apache.camel.support.http.HttpUtil;
19+
import org.apache.camel.Exchange;
20+
import org.apache.camel.http.base.HttpHeaderFilterStrategy;
2121

22-
/**
23-
*
24-
* @deprecated use {@link org.apache.camel.http.base.HttpHeaderFilterStrategy} instead.
25-
*/
26-
public class UndertowHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
22+
public class UndertowHeaderFilterStrategy extends HttpHeaderFilterStrategy {
2723

2824
public UndertowHeaderFilterStrategy() {
2925
initialize();
3026
}
3127

32-
protected void initialize() {
33-
HttpUtil.addCommonFilters(getOutFilter());
34-
35-
setLowerCase(true);
36-
37-
// filter headers begin with "Camel" or "org.apache.camel"
38-
// must ignore case for Http based transports
39-
setOutFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
40-
setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
28+
@Override
29+
public boolean applyFilterToExternalHeaders(String headerName, Object headerValue, Exchange exchange) {
30+
boolean skip = io.undertow.util.HttpString.tryFromString(headerName) == null;
31+
if (skip) {
32+
// skip all not valid headers by undertow rules
33+
return true;
34+
}
35+
return super.applyFilterToExternalHeaders(headerName, headerValue, exchange);
4136
}
4237
}

docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_17.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ Disabling virtual threads by setting system property `org.infinispan.threads.vir
7070

7171
Upgraded to Tika v3, and removed `textMain` from `tikaParseOutputFormat` option.
7272

73+
=== camel-undertow
74+
75+
This component will not skip headers that has invalid characters in key names (UT10052), implemented
76+
in the `UndertowHeaderFilterStrategy` class.
77+
7378
=== Component deprecation
7479

7580
The `camel-stomp` component is deprecated.

0 commit comments

Comments
 (0)