websocket icon indicating copy to clipboard operation
websocket copied to clipboard

docs: client: clarify handshake error conditions

Open WofWca opened this issue 1 year ago • 0 comments

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [ ] Feature
  • [ ] Bug Fix
  • [ ] Optimization
  • [x] Documentation Update
  • [ ] Go Version Update
  • [ ] Dependency Update

Description

The purpose of this change is to set this behavior in stone, so that, for example, introducing "follow redirects" by default would be a breaking change. The WebSocket spec actually allows the client to follow redirects:

the server might redirect the client using a 3xx status code (but clients are not required to follow them)

I think this library should be explicit about whether it does this.

I feel like the existing "...so that callers can handle redirects, authentication, etcetera" is not worded strongly enough.

Background: I'm working on an application that makes connections to arbitrary addresses, so a target WebSocket server might be malicious. Thus I want to limit the scope of what a malicious server can do. For example, ensure that it's not gonna redirect the client to a private address, or to a DDoS target.

Related Tickets & Documents

Added/updated tests?

  • [ ] Yes
  • [x] No, and this is why: this is purely a documentation change
  • [ ] I need help with writing tests

Run verifications and test

  • [ ] make verify is passing
  • [ ] make test is passing

WofWca avatar Nov 16 '24 13:11 WofWca