gorilla / websocket

Package gorilla/websocket is a fast, well-tested and widely used WebSocket implementation for Go.
https://gorilla.github.io
BSD 2-Clause "Simplified" License
22.06k stars 3.47k forks source link

Is https not supported? #794

Open yuting-fan opened 2 years ago

yuting-fan commented 2 years ago

It looks like gorilla websocket intends to support https, e.g logic here.

However, https is not registered during init here.

This caused https to be considered as an unknown proxy when we use https proxy, error thrown from here.

Is this a bug? Shouldn't the proxy_RegisterDialerType be initialized with https?

ayjayt commented 1 year ago

Websockets does support https. The client dialers expect you to pass scheme wss://, not https://.

That being said, the behavior your mentioning IMO is an issue (so picky about scheme), but bottom line is that gorilla websocket does support TLS and will connect to an https server.

ayjayt commented 1 year ago

Infuriating: https://github.com/gorilla/websocket/blob/9111bb834a68b893cebbbaed5060bdbc1d9ab7d2/client.go#L174

ghost commented 1 year ago

The issue is asking about support for HTTPS proxy servers, not whether the package supports WSS or not.

To reduce confusion, the issue title should be changed to "Are HTTPS proxy servers supported?"

ghost commented 3 months ago

There are two URLs in play in the dial code:

It looks like gorilla websocket intends to support https, e.g logic here.

This is the protocol used for the upgrade request. The WSS protocol uses HTTPS for the upgrade request.

However, https is not registered during init here.

The registration is for proxy URLs, not for the upgrade request URL.

This caused https to be considered as an unknown proxy when we use https proxy, error thrown from here.

HTTPS proxies are not supported, but that does not imply that WSS (and the HTTPS upgrade request) are not supported through a proxy.

@yuting-fan If the code failed here in your application, then your application's Dialer.Proxy function returned an HTTPS URL. Did you intend to use an HTTPS proxy?

Edit: @yuting-fan Did you encounter a problem in your application, or are you speculating that there's a bug?

adrianosela commented 1 month ago

Hey folks, are there no active plans to support websockets over HTTPS proxies?

cc @canelohill , etc

ghost commented 1 month ago

@adrianosela see #939