Claus Ibsen created CAMEL-27482:
-----------------------------------

             Summary: camel-vertx-websocket - the query of a remote WebSocket 
URI is sent decoded, so %2B becomes a space and %26 splits a parameter
                 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
             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