Skip to content

WebSocket request via proxy doesn't match standard. #300

@kingsfleet

Description

@kingsfleet

So I have a simple client connecting to a echo websocket service over a secured connection via a web proxy:

AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()
.setProxyServer(new ProxyServer("localhost", 8099)).build();

AsyncHttpClient c = new AsyncHttpClient(config);

final CountDownLatch latch = new CountDownLatch(2);

WebSocket websocket = c.prepareGet("wss://localhost:8101/Project1/echo")
.execute(new WebSocketUpgradeHandler.Builder().addWebSocketListener(new WebSocketTextListener() {

    @Override
    public void onOpen(WebSocket webSocket) {
        // TODO Implement this method
    }

    @Override
    public void onClose(WebSocket webSocket) {
        // TODO Implement this method
    }

    @Override
    public void onError(Throwable throwable) {
        // TODO Implement this method
    }

    @Override
    public void onMessage(String message) {
        System.out.println(message);
        latch.countDown();
    }

    @Override
    public void onFragment(String string, boolean b) {
        // TODO Implement this method

    }
}).build()).get();

When connecting to the web proxy the client initially send the following headers using the CONNECT method "Connection, Upgrade, Origin, Sec-WebSocket-Key, Sec-WebSocket-Version, Host, Proxy-Connection, Alive".

But since this we a secure connection I was expecting a simple CONNECT followed by a TLS handshake as described by:

http://tools.ietf.org/html/rfc6455#section-4.1

It would appear that this is not consistent with the spec and is causing our proxy to fail.

I am using the shadded version of 1.7.16 web socket client.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions