webtorrent / bittorrent-tracker

🌊 Simple, robust, BitTorrent tracker (client & server) implementation
https://webtorrent.io
MIT License
1.73k stars 315 forks source link

Let ws protcol in https context fail #430

Closed Corentin-pro closed 1 year ago

Corentin-pro commented 1 year ago

What is the purpose of this pull request? (put an "X" next to item)

What changes did you make? (Give an overview)

Remove the check for ws protocol in https context in client (when mapping the announce URLs). The WebSocketTracker is then allays created.

Which issue (if any) does this pull request address?

In secure context (HTTPS) the bittorrent-tracker client will not open any websocket if the announce URL is using ws protocol. This leads to silent failing in the announcing process. a nextTickWarn should give away the reason but if this is the only announce the tick will never happen.

Letting the websocket try to connect allows for nice an direct debug message:

simple-websocket [...] destroy (error: The operation is insecure.)

This error can be easily searched and traced back to Firefox's specific behavior on the matter.

Is there anything you'd like reviewers to focus on?

We could have instead a debug message instead of removing the check. Both options looks better, in case of change of mind from Firefox in the future I think the WebSocket should be created anyway.

welcome[bot] commented 1 year ago

🙌 Thanks for opening this pull request! You're awesome.

github-actions[bot] commented 1 year ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?