Skip to content

Fix Host header port and blame for invalid target names - #301

Merged
maximilianfeix merged 2 commits into
mainfrom
claude/brave-maxwell-uztdyx
Oct 8, 2026
Merged

maximilianfeix merged 2 commits into
mainfrom
claude/brave-maxwell-uztdyx

Conversation

@maximilianfeix

@maximilianfeix maximilianfeix commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

What does this change?

Closes #300

  • netio.http_request sends the port in the Host header when it isn't the scheme's default (IPv6 literals in brackets); the same port value is used for the connection and the header.
  • The rotating server validates the target name once, before any proxy is picked (valid_hostname in server/http.py): empty or over-long IDNA labels, names over 255 bytes, spaces and control characters get a 502 without counting against any proxy and without touching the pool.
  • The server's Host header and forwarded request line bracket IPv6 literals (reusing netio.host_header).
  • CHANGELOG entries.

How was it tested?

  • python3 -m pytest passes (1036 passed, 3 skipped)
  • ruff check . is clean
  • tried it for real: tests/test_bad_hosts_and_host_header.py starts a local server and checks the Host header, and sends CONNECT example..com:443 through a pool of three SOCKS5 proxies – before the fix they were disabled, now fail == 0 for all.

Screenshots

n/a

🤖 Generated with Claude Code

https://claude.ai/code/session_01RVmJ6btzu5tQgxccHb1SoS

claude added 2 commits October 8, 2026 08:44
Closes #300

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RVmJ6btzu5tQgxccHb1SoS
…ver Host headers (#300)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RVmJ6btzu5tQgxccHb1SoS
@maximilianfeix
maximilianfeix merged commit aea415b into main Oct 8, 2026
20 of 21 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.

Host header drops the port; invalid target names count against upstream proxies

2 participants