Skip to content

[camel-4.18.x] CAMEL-25917: camel-undertow - a WebSocket connection accepted while only a producer served the path is not treated as having passed a later consumer's custom handlers - #28506

Merged
davsclaus merged 1 commit into
apache:camel-4.18.xfrom
Croway:fix/CAMEL-25917-camel-4.18.x
Oct 26, 2026

Conversation

@Croway

@Croway Croway commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Jira: https://issues.apache.org/jira/browse/CAMEL-25917

Backport of #28237 to camel-4.18.x (cherry-pick of 56aa5f4).

On a WebSocket path whose producer applies a security provider or allowed roles, a connection accepted while only the producer served the path, before its consumer was first started, did not run the custom handlers that the consumer configures. Once the consumer started, that connection was still served. The handshake result now records whether it ran in consumer mode, so such a connection is no longer served once a consumer with handlers is up, and the consumer closes it as soon as it starts. The window tests send on that connection on a best effort basis, since it may already be closed.

  • camel-4x-upgrade-guide-4_24.adoc does not exist on this branch, so it is left out. On this line, the handlers, allowedRoles and security provider options apply to WebSocket endpoints from 4.18.6 on (CAMEL-25375), so the doc-sync PR on main extends the existing 4.18.6 camel-undertow WebSocket entry.
  • UndertowWsOAuthProfileConsumerWindowTest does not exist on this branch (the oauthProfile support of CAMEL-23723 is not on 4.18.x), so its change is left out.
  • CamelWebSocketHandler applied without a textual conflict. This branch has no OAuth checks in the handler, so the change only touches the handshake result, isAuthenticated and the new close of the peers when the consumer is set, as on main.

Tests: components/camel-undertow mvn verify on this branch: BUILD SUCCESS, 199 tests, 0 failures, 1 skipped (including SecurityProviderWebSocketConsumerHandlersWindowTest and UndertowWsSecurityWithoutProviderTest)

…nly a producer served the path is not treated as having passed a later consumer's custom handlers (apache#28237)

* CAMEL-25917: camel-undertow - a WebSocket connection accepted while only a producer served the path is not treated as having passed a later consumer's custom handlers

* CAMEL-25917: close WebSocket peers that no longer pass the path checks when the consumer starts

Close the already-open connections of a path right away when a consumer is
set, rather than only when they next send a message, so a receive-only client
is told to reconnect instead of silently receiving nothing after the consumer
with custom handlers starts. Add a regression test that awaits the close
without the client sending, and adjust the existing window tests for the now
proactive close.

* CAMEL-25917: camel-undertow - make the window tests tolerate the proactive close

The consumer now closes a connection opened before it started as soon as it
starts, so sending on that connection afterwards is best effort and bounded.

(cherry picked from commit 56aa5f4)
@davsclaus davsclaus added this to the 4.18.6 milestone Oct 26, 2026
@davsclaus davsclaus added the enhancement New feature or request label Oct 26, 2026
@davsclaus
davsclaus merged commit 03ff366 into apache:camel-4.18.x Oct 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants