Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: client: clarify handshake error conditions #965

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WofWca
Copy link

@WofWca WofWca commented Nov 16, 2024

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

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • 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
  • 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

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](https://www.rfc-editor.org/rfc/rfc6455) 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.

Signed-off-by: WofWca <wofwca@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant