[ 
https://issues.apache.org/jira/browse/CAMEL-27482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149961#comment-18149961
 ] 

Claus Ibsen commented on CAMEL-27482:
-------------------------------------

Scope, after looking closer:

* A plain {{%2B}} or {{%26}} in an endpoint URI (without RAW) is decoded by 
Camel's endpoint URI normalization before any component reads it: 
{{p=a%2Bb&t=x%26y}} reaches the component as {{p="a b"}}, {{t="x"}}, {{y=""}}. 
That is the same for every component, and RAW() is the documented way around it 
(endpoint.adoc, "Configuring parameter values using raw values"). Not changed 
here.
* The bug in camel-vertx-websocket: a RAW value was sent decoded as well. 
{{token=RAW(a+b)&sig=RAW(x&y=z)}} went out as {{token=a+b&sig=x&y=z}}, because 
the request URI was built from the decoded path and query 
({{URISupport.pathAndQueryOf}}), and the default host/port/path branch rebuilt 
the URI from {{getQuery()}}.

Fix: https://github.com/apache/camel/pull/30688

_Claude Code on behalf of davsclaus_

> camel-vertx-websocket - a RAW value in the query of a remote WebSocket URI is 
> sent decoded, so + becomes a space and & splits the value
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27482
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27482
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-vertx-websocket
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> For a client (consumeAsClient, or a producer to a remote server), the query 
> parameters of the endpoint URI are sent decoded:
> {noformat}
> vertx-websocket:localhost:8080/path?consumeAsClient=true&p=a%2Bb&t=x%26y   -> 
> GET /path?p=a+b&t=x&y=
> vertx-websocket:localhost:8080/path?consumeAsClient=true&p=RAW(a+b)&t=RAW(x&y)
>  -> GET /path?p=a+b&t=x&y
> {noformat}
> The server reads {{p}} as "a b", and {{t}} is split into {{t=x}} and {{y=}}. 
> Tokens and signatures in the URL break. Even {{RAW()}} does not help: the URI 
> holds the right raw query ({{p=a%2Bb&t=x%26y}}), but 
> {{VertxWebsocketEndpoint.getWebSocketConnectOptions}} builds the request URI 
> with {{URISupport.pathAndQueryOf}}, which uses the decoded 
> {{getPath()}}/{{getQuery()}}.
> Fix: send the raw path and a correctly encoded query, so the server gets the 
> values as written in the endpoint URI.
> Test: a server that echoes its query, with %2B, %26 and %20 in values, plain 
> and with RAW().
> Found while writing apache/camel-kamelets#3378 (xpath-filter-action) and 
> #3379 (websocket-source/-sink).
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to