[ 
https://issues.apache.org/jira/browse/CAMEL-24360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-24360:
--------------------------------
    Fix Version/s: 4.22.0

> camel-undertow - UndertowEndpoint discards the UndertowHeaderFilterStrategy 
> set by DefaultUndertowHttpBinding
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24360
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24360
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-undertow
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Major
>             Fix For: 4.22.0
>
>
> {{DefaultUndertowHttpBinding}} installs {{UndertowHeaderFilterStrategy}} as 
> its default in the constructor:
> {code:java}
> public DefaultUndertowHttpBinding(boolean useStreaming) {
>     this.headerFilterStrategy = new UndertowHeaderFilterStrategy();
>     ...
> }
> {code}
> but {{UndertowEndpoint}} overwrites it immediately when it lazily creates 
> that binding:
> {code:java}
> private HeaderFilterStrategy headerFilterStrategy = new 
> HttpHeaderFilterStrategy();   // line 88
> public UndertowHttpBinding getUndertowHttpBinding() {
>     if (undertowHttpBinding == null) {
>         // create a new binding and use the options from this endpoint
>         undertowHttpBinding = new DefaultUndertowHttpBinding(useStreaming);
>         
> undertowHttpBinding.setHeaderFilterStrategy(getHeaderFilterStrategy());
>         ...
> {code}
> So unless the user explicitly supplies a custom {{UndertowHttpBinding}} or a 
> custom {{headerFilterStrategy}}, the binding ends up running the base 
> {{HttpHeaderFilterStrategy}} and the undertow-specific strategy never 
> executes.
> Two behaviours that are documented as shipped therefore do not take effect on 
> endpoint-configured routes:
> * the {{websocket.}} in/out filter prefix added to 
> {{UndertowHeaderFilterStrategy}} by CAMEL-23588;
> * the {{io.undertow.util.HttpString.tryFromString}} header-name validation in 
> {{UndertowHeaderFilterStrategy.applyFilterToExternalHeaders}}, which skips 
> header names undertow considers invalid.
> The 4.14 / 4.18 / 4.21 upgrade guides describe the CAMEL-23588 behaviour as 
> active, so the documented behaviour and the runtime behaviour diverge.
> *Proposed change:* either
> * default {{UndertowEndpoint.headerFilterStrategy}} to {{new 
> UndertowHeaderFilterStrategy()}} instead of {{new 
> HttpHeaderFilterStrategy()}}, or
> * only push the endpoint strategy into the binding when one was explicitly 
> configured, leaving the binding's own default in place otherwise.
> Add a test asserting that a binding created through 
> {{UndertowEndpoint.getUndertowHttpBinding()}} runs 
> {{UndertowHeaderFilterStrategy}}.
> Affects: {{main}} (4.22.0-SNAPSHOT), {{camel-4.18.x}}, {{camel-4.14.x}} - 
> {{UndertowEndpoint}} line 88 (and the push at line 321 on the LTS branches, 
> line 330 on main) and {{DefaultUndertowHttpBinding}} line 86 are identical on 
> all three branches, so the change should be backported.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to