oscerd opened a new pull request, #25367:
URL: https://github.com/apache/camel/pull/25367
## Description
`DefaultUndertowHttpBinding` installs an `UndertowHeaderFilterStrategy` in
its constructor:
```java
public DefaultUndertowHttpBinding(boolean useStreaming) {
this.headerFilterStrategy = new UndertowHeaderFilterStrategy();
...
}
```
but `UndertowEndpoint` defaulted its own field to the base
`HttpHeaderFilterStrategy` and pushed that into the binding when creating it
lazily, overwriting what the binding had just set:
```java
private HeaderFilterStrategy headerFilterStrategy = new
HttpHeaderFilterStrategy(); // line 88
public UndertowHttpBinding getUndertowHttpBinding() {
if (undertowHttpBinding == null) {
undertowHttpBinding = new DefaultUndertowHttpBinding(useStreaming);
undertowHttpBinding.setHeaderFilterStrategy(getHeaderFilterStrategy());
// overwrites it
...
```
Unless the user supplied a custom binding or a custom
`headerFilterStrategy`, the binding ran the base strategy and the
undertow-specific filtering never executed.
## Impact
Two behaviours documented as shipped were inert on endpoint-configured
routes:
- the legacy `websocket.*` Exchange-header prefix added to the in/out
filters by CAMEL-23588 (released in 4.14.8 / 4.18.3 / 4.21.0 and described in
the 4.18 upgrade guide);
- the `io.undertow.util.HttpString.tryFromString` header-name validation in
`UndertowHeaderFilterStrategy.applyFilterToExternalHeaders`, which skips header
names undertow does not accept.
Documentation and runtime behaviour had therefore diverged since CAMEL-23588.
## Fix
`UndertowEndpoint` now defaults to `UndertowHeaderFilterStrategy`, so both
take effect.
- Rest DSL consumers are unchanged: `UndertowComponent` already assigns
`UndertowRestHeaderFilterStrategy`, which extends
`UndertowHeaderFilterStrategy`.
- Endpoints configuring `headerFilterStrategy` or `undertowHttpBinding`
explicitly keep their behaviour.
- Ordinary application headers are unaffected; the two added filters are
narrow.
The now-unused `HttpHeaderFilterStrategy` import is removed. No generated
metadata changes, since the catalog records only the `HeaderFilterStrategy`
interface and not the default implementation class.
## Changes
- `UndertowEndpoint` - default strategy, unused import
- `UndertowEndpointTest` - three cases: the endpoint default is
undertow-specific; the lazily created binding keeps it and actually filters
`UndertowConstants.CONNECTION_KEY` / `CONNECTION_KEY_LIST` / `SEND_TO_ALL`; an
explicitly configured strategy still reaches the binding
- 4.22 upgrade-guide entry, including how to restore the previous behaviour
## Testing
- `camel-undertow` module build green: **191 tests pass, 0 failures, 1
skipped**. The websocket suites (`UndertowWsConsumerRouteTest`,
`UndertowWsTwoRoutesToSameEndpointSendToAllHeaderTest`, ...) all still pass,
since the producer reads those headers via `in.getHeader(...)`, which does not
go through the `HeaderFilterStrategy`.
- Full reactor build from root (`mvn clean install -DskipTests`) green, no
regenerated-artifact drift.
## Backport
`UndertowEndpoint` line 88 and `DefaultUndertowHttpBinding` line 86 are
identical on `main`, `camel-4.18.x` and `camel-4.14.x`, so this should be
backported to both LTS lines (with the matching 4.18 / 4.14 upgrade-guide
entries doc-synced back to `main` per the backport policy). Backporting matters
here because CAMEL-23588 shipped on those branches and its documented effect is
what this restores.
---
_Claude Code on behalf of oscerd_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]