Skip to content

Conversation

@Weixi779
Copy link

@Weixi779 Weixi779 commented Oct 20, 2025

Background

I noticed issue #147 regarding the incorrect WebSocket proxy URL construction. I also saw a similar solution proposed
in PR #149 by @GEverding, which correctly identified the root cause of the problem.

However, PR #149 received a change request from @0xTim asking for tests to verify the proxy URI generation. Since that
PR has not been updated, I have created this PR with the complete fix including the requested test modifications.

Changes

1. Fix proxy URL construction order - Fixes #147

2. Add missing configuration parameter

  • Pass configuration parameter when connecting through proxy
  • Ensures client configuration is properly forwarded to the underlying connection

3. Use correct URI form for wss + proxy connections

  • For wss with proxy: use origin-form (/path) after CONNECT tunnel per RFC 7230
  • For ws with proxy: continue using absolute-form (ws://host:port/path)
  • This fixes potential compatibility issues with strict HTTP/1.1 servers

Tests

  • ✅ All existing tests pass (24 tests)
  • testProxy and testProxyTLS verify the fixes work correctly

Note

testBadHost test is skipped in test runs as it hangs indefinitely when attempting to connect to an invalid hostname.
This is a pre-existing issue in the test suite, unrelated to these fixes.

@Weixi779 Weixi779 requested review from 0xTim and gwynne as code owners October 20, 2025 15:57
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.

WSS Proxy Setup Broken

1 participant