Skip to content

Guard httpx 1.x imports, pin client extras, and widen CI - #34

Draft
proxymeshai wants to merge 1 commit into
mainfrom
cursor/httpx-compat-ci-metadata-e771
Draft

proxymeshai wants to merge 1 commit into
mainfrom
cursor/httpx-compat-ci-metadata-e771

Conversation

@proxymeshai

@proxymeshai proxymeshai commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Importing the httpx adapter no longer crashes on httpx 1.x. httpx 1.0.dev6 (2026-08-31) is a rewrite without httpcore, without AsyncHTTPTransport / HTTPTransport, and without proxy support (encode/httpx#947). The module warns and raises UnsupportedHttpxVersion when used. The [httpx] extra is httpx>=0.28,<1. No 1.0 adapter in this PR.
  • Contract tests plus a local CONNECT mock exercise the private hooks in urllib3, httpx/httpcore, and aiohttp, and name the symbol when it moves.
  • Packaging: keywords, classifiers, per-client extras with tested ranges, and a changelog URL.
  • PR CI runs a Python matrix and the local mock (no secrets). A weekly job, also runnable with workflow_dispatch, installs the newest stable and pip install --pre clients. That workflow is not a pull_request check, so a pre-release failure is visible in Actions and does not block PRs.

httpx 1.0 support options

httpx 1.0.dev6 replaces the httpcore stack with Client, Connection, ConnectionPool, and NetworkBackend. There is no CONNECT API. This PR does not port handle_request.

  1. Stay on httpx 0.28.x. Supported path. pip install 'python-proxy-headers[httpx]' pins httpx>=0.28,<1. Import on 1.x warns; calling the helpers raises UnsupportedHttpxVersion.
  2. Wait for a public proxy hook. NetworkBackend.connect / connect_tls and Transport.send open a direct connection. They cannot send CONNECT headers or return the proxy response. When Version 1.0 encode/httpx#947 adds a public API, implement against that instead of another private copy.
  3. A small CONNECT backend, later. Open the proxy socket, write CONNECT and the custom headers, read the proxy response, wrap TLS, and hand the stream to httpx.Connection. NetworkBackend does not accept an existing socket today, and the 1.0 API is still early.
  4. Leave httpcore out of this package. Vendoring it would freeze a private stack httpx 1.0 has already removed.

Same note in docs/httpx.rst.

Repository settings

Not changed here (owner settings):

  • Description: Send and read custom proxy headers on HTTPS CONNECT for requests, urllib3, httpx and aiohttp
  • Topics: proxymesh, https, connect, tunnel

Changes

  1. httpx 1.x: httpx_proxy.py classifies the installed httpx and loads _httpx_httpcore.py only for 0.x. httpx >= 1 warns at import and the public helpers raise UnsupportedHttpxVersion. Verified against the real httpx==1.0.dev6 wheel (no AsyncHTTPTransport, no httpcore).
  2. Private hooks: test_client_internals.py checks signatures and runs urllib3 (_prepare_proxy, _tunnel, http.client._read_headers), httpx (handle_request / handle_async_request), and aiohttp (_create_proxy_connection) through tests/mock_connect_proxy.py. Failures name the upstream symbol. Adapters were not rewritten.
  3. Packaging: keywords; classifiers (Beta, Python 3.10–3.14, Proxy Servers, AsyncIO); extras [urllib3], [requests], [httpx], [aiohttp], [pycurl], [cloudscraper], [autoscraper] checked against urllib3 2.8.0, requests 2.34.2, httpx 0.28.1 / httpcore 1.0.9, aiohttp 3.14.5, pycurl 7.48.0, cloudscraper 1.2.71, autoscraper 1.1.14. requires-python is >=3.10 because those clients require it and the httpx adapter already uses str | None. Changelog URL is CHANGELOG.md on main.
  4. CI: ubuntu-24.04 only. PR unit job matrix is Python 3.10, 3.12, 3.13, 3.14, installs the extras, and runs test_header_security.py plus the local mock. The existing PROXY_URL job stays, on Python 3.12, still using the compatible extras. Client compatibility runs Mondays 15:00 UTC and on workflow_dispatch, for Python 3.12 and 3.14, channels stable and pre. Pre-release failures fail that workflow and are not pull_request checks.

Test plan

  • python test_header_security.py (pycurl 7.48.0 included)
  • python test_client_internals.py on httpx 0.28.1 (urllib3, httpx sync/async, aiohttp through the mock; pycurl, cloudscraper, autoscraper imports)
  • Same suite with httpx==1.0.dev6 on PYTHONPATH: import warns, helpers raise UnsupportedHttpxVersion, httpcore tests skip, urllib3 and aiohttp still pass
  • PR CI: unit on Python 3.10, 3.12, 3.13, and 3.14, plus PROXY_URL integration (run 39897808523)
Open in Web Open in Cursor 

httpx 1.0.dev6 drops httpcore and AsyncHTTPTransport. Importing the httpx
adapter now warns and raises UnsupportedHttpxVersion instead of ImportError.
Optional extras pin tested client ranges, and CI runs a Python matrix plus a
local CONNECT mock. A weekly workflow checks latest and pre-release clients
without gating pull requests.

Co-authored-by: ProxyMesh AI <proxymeshai@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant