Skip to content

Allow outgoing connections via proxies #582

@lukester1975

Description

@lukester1975

Hi

I've integrated WebSocket++ in to an existing socket library (with much help from the iostreams transport). All working nicely - thanks for the library!

Next I thought I'd try connecting via a WebSocket supporting proxy (Apache in this case). This is not using CONNECT, it's a GET via the proxy.

So after connecting to the proxy but before initiating the WebSocket++ connection, I do some connection::append_header() calls to set the auth required for the proxy. That works fine, but the actual upgrade request fails since the URI contains only a relative URI. I.e. in hybi13::client_handshake_request():

req.set_method("GET");
req.set_uri(uri->get_resource());
req.set_version("HTTP/1.1");

... and proxies require the full absolute URI. Changing it to:

req.set_method("GET");
req.set_uri(uri->str());
req.set_version("HTTP/1.1");

works well so far both via a proxy and direct.

However, it's probably nicer to stick with a relative URI when connecting directly. Does this make sense? I could make a pull request, though there are many ways it could be done and I'm not really 100% on the WebSocket++ structure at this point, so not sure what way would be considered cleanest...

Anyway, just an idea. Thanks again.

Luke.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions