Skip to content

docs: client: clarify handshake error conditions#965

Open
WofWca wants to merge 1 commit intogorilla:mainfrom
WofWca:patch-1
Open

docs: client: clarify handshake error conditions#965
WofWca wants to merge 1 commit intogorilla:mainfrom
WofWca:patch-1

Conversation

@WofWca
Copy link
Copy Markdown

@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>
scalecode-solutions referenced this pull request in scalecode-solutions/magilla Apr 24, 2026
Foundation commit for the personal fork. No behavior change beyond
what the Go toolchain and std-lib bumps imply.

Module & toolchain
  * Rewrite module path to github.com/scalecode-solutions/websocket
    across go.mod, README, examples, and import statements.
  * Bump language version from 1.20 -> 1.26 (matches local toolchain).
  * Bump golang.org/x/net from v0.26.0 -> v0.53.0, closing the path
    flagged by upstream issue #991 (HTTP/2 CVEs in older x/net).

Hygiene (small, mechanical)
  * interface{} -> any across compression.go, conn.go, conn_test.go,
    and json.go (upstream PR #1000). BufferPool interface signature
    changes are source-compatible since any is an alias.
  * Fix "best effor" -> "best effort" and "buferred" -> "buffered"
    typos in conn.go and server.go (upstream PR #975, carried in
    PR #1011).
  * Add the missing blank line before the Deprecated: marker on
    UnderlyingConn so godoc/linters treat it as deprecated
    (upstream PR #998).
  * Extend the DialContext godoc to note that non-101 responses
    produce an error (upstream PR #965).

Drop pre-1.21 compat cruft
  * Delete mask_safe.go and the !appengine build tags. Classic
    App Engine required a sandboxed Go runtime without unsafe; it
    was retired in 2020 and modern App Engine uses the standard
    toolchain.
  * Drop legacy `// +build` lines (Go 1.18+ only needs //go:build).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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