vert.x icon indicating copy to clipboard operation
vert.x copied to clipboard

Pass the initiating request URI (or request object) to DefaultWebSocket

Open gulrotkake opened this issue 13 years ago • 4 comments

In DefaultHttpServer when an UPGRADE request is received a DefaultWebSocket is constructed. It seems however that only the path segment of the URI is passed on as context. Ie:

theURI = new URI(request.getUri());
...
DefaultWebSocket ws = new DefaultWebSocket(vertx, theURI.getPath(), wsConn, connectRunnable);

It would be nice to have the entire URI (for example to retrieve query arguments) or even the entire request to see what headers were passed in the initiating request.

gulrotkake avatar Apr 08 '13 14:04 gulrotkake

+1 for this

winash avatar Apr 08 '13 15:04 winash

It's a common misconception in HTTP that an absolute url is passed in the request - this is rarely true. Almost always a relative url is passed. So Vert.x is simply passing on what it has received from the client.

purplefox avatar Apr 19 '13 15:04 purplefox

Yes, that's true, but query arguments are part of the path passed in the http request. Ie GET /foo/bar?a=b HTTP/1.0

When vert.x only passes the path element of a Java URI this information is lost.

gulrotkake avatar Apr 19 '13 17:04 gulrotkake

That may be true, but it's a different issue.

purplefox avatar Apr 20 '13 06:04 purplefox