Skip to content

Expose rejected handshake response headers in Error events - #637

Merged
bsergean merged 1 commit into
masterfrom
fix/handshake-error-headers
Nov 9, 2026
Merged

bsergean merged 1 commit into
masterfrom
fix/handshake-error-headers

Conversation

@bsergean

@bsergean bsergean commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

When a server rejects a WebSocket handshake, applications receive its HTTP status and reason but cannot inspect response headers such as Retry-After or custom authentication details.

Add WebSocketErrorInfo::headers and populate it from the existing WebSocketInitResult headers when reporting a connection error. Document access through msg->errorInfo.headers. This is a small C++11-compatible API addition; header parsing is unchanged.

Closes #636.

Validation:

  • End-to-end tests reject real WebSocket handshakes with HTTP 401 and 503, then verify the Error callback receives the status, reason, custom headers, and Retry-After with case-insensitive lookup.
  • Full local OpenSSL suite: 25/25 passing.
  • HTTP header tests pass under ThreadSanitizer (52 assertions across 5 test cases).
  • Formatting and git diff --check pass.

@bsergean
bsergean merged commit a831f11 into master Nov 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose failed WebSocket handshake response headers in WebSocketErrorInfo

1 participant