Skip to content

Apply connect timeout to SOCKS5 handshakes - #1091

Open
lin-hongkuan wants to merge 1 commit into
encode:masterfrom
lin-hongkuan:codex/socks5-handshake-connect-timeout
Open

Apply connect timeout to SOCKS5 handshakes#1091
lin-hongkuan wants to merge 1 commit into
encode:masterfrom
lin-hongkuan:codex/socks5-handshake-connect-timeout

Conversation

@lin-hongkuan

@lin-hongkuan lin-hongkuan commented Jun 25, 2026

Copy link
Copy Markdown

Fixes #1089.

Summary

  • pass the request connect timeout into SOCKS5 handshake setup
  • apply it to auth method, username/password, and connect request read/write calls
  • add sync/async regression tests that assert SOCKS handshake I/O receives the connect timeout

Tests

  • py -m pytest tests\_sync\test_socks_proxy.py::test_socks5_request_uses_connect_timeout_for_handshake -q
  • py -m pytest tests\_async\test_socks_proxy.py::test_socks5_request_uses_connect_timeout_for_handshake -q
  • py -m pytest tests\_sync\test_socks_proxy.py tests\_async\test_socks_proxy.py -q
  • uvx ruff==0.5.0 format httpcore tests --diff
  • uvx ruff==0.5.0 check httpcore tests
  • python scripts\unasync.py --check
  • git diff --check HEAD~1..HEAD

@lin-hongkuan
lin-hongkuan force-pushed the codex/socks5-handshake-connect-timeout branch from 0e326b0 to 87feb69 比较 June 25, 2026 04:44
@mbeijen

mbeijen commented Jun 25, 2026

Copy link
Copy Markdown

This is a duplicate of #1017 and also of #1055. Please note that httpcore is not getting active maintenance anymore, unfortunately. There is now httpx2, which is a maintained version, but that has the same problem wrt the proxy timeout!! See pydantic/httpx2#1009

注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

None yet

Development

Successfully merging this pull request may close these issues.

_init_socks5_connection ignores timeout — SyncStream.read() puts socket into infinite blocking mode

2 participants