Repository navigation
feat: HTTPX drop-in Phase 2 — object model and core API parity - #6
Merged
Merged
Conversation
Phase 2 implements the HTTPX 0.28.1 public data model and client API as a pure-Python compatibility facade over the eggfetch Rust engine. Compatibility module (eggfetch.compat.httpx): - URL and QueryParams with full construction, normalization, copy, join - Headers with case-insensitive lookup, duplicate preservation, raw access - Cookies with mapping semantics, domain/path, extract/update - Timeout, Limits, Proxy configuration value objects - Complete exception hierarchy matching HTTPX MRO (23 exception classes) - Request with body mutual exclusion, auto-headers, read/aread - Response with status helpers, encoding, raise_for_status, iterators - Client and AsyncClient with constructor signatures matching HTTPX 0.28.1 - Configuration merge semantics (params, headers, cookies, timeout, auth) - build_request() and send() with request identity preservation - Top-level helpers (get, post, put, patch, delete, head, options, request) - Transport and stream base class stubs for Phase 4+ - Bridge module for native ↔ compat conversion Tests: 407 new tests across 10 test files covering URL, QueryParams, Headers, Cookies, config objects, exceptions, Request, Response, Client, and configuration merge matrix. Docs: Updated README, AGENTS.md, python-bindings skill, and architecture docs. Added Phase 2 status file with acceptance criteria.
dbowm91
pushed a commit
that referenced
this pull request
Aug 26, 2026
Core: - retry: default backoff factor 0.5 -> 2.0 so delays grow between retries; docs aligned (audit #2) - proxy: CONNECT target brackets IPv6 literals in authority-form (#3) - proxy: effective_timeout() now measures remaining budget with a fresh Instant per phase, enforcing one monotonic request deadline across multi-phase proxy setup instead of a stale snapshot (#4) - proxy: reject truncated status/header lines on EOF (#14); header-count limit checked before push, admitting exactly MAX (#19) - pipeline: redirect drain uses the byte-bounded helper under the total deadline (no full-body buffering) and gains a time cap when no total is set; applies to the retry-path drain too (#10) - pool: closed per-origin semaphore no longer bypasses both limits; the request stays bounded by the global permit (#18) - http3: sender cache uses per-origin OnceCell cells so concurrent requests share one QUIC connection instead of racing get-then-insert and orphaning driver tasks (#15) FFI: - streaming: cancel/free publish on a watch channel that a parked next selects on, so a blocked reader wakes immediately even on idle streams (#5); allocation/poison failures set last_error before returning null (#11); state is Arc-shared so free during a parked next is safe (#12); next routes through runtime-aware blocking_send Python bindings: - network_stream: sync read/write acquire the OS mutex inside allow_threads so a contended lock never stalls other Python threads while holding the GIL (#9) Compat facade (httpx): - URL: schemeless inputs are kept as relative references instead of being prefixed with a fabricated http:// authority; join() performs RFC 3986 resolution; _redirect_url resolves Location via urljoin so relative (./b, ../baz) and protocol-relative (//host) redirects dispatch to the correct host (#1, #6, #7) - Headers: get()/[] comma-join duplicate values like HTTPX (#8) - Response: iter_bytes/aiter_bytes raise StreamClosed after close, matching iter_raw (#16) - auth: callables returning neither Request nor iterable raise TypeError instead of silently sending unauthenticated requests (#17) CLI: - --file implies POST like curl -F (#13) - NDJSON mode drops the embedded history array; hops are emitted once as their own records (#20) - --retry-delay pins backoff factor to 1 for flat inter-retry delay Tests updated/added for each behavior change. Note: this changes the executable SHA, so the exact-SHA compat qualification ledger requires restarting its freeze step per plans/httpx-parity-correction-status.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the HTTPX 0.28.1 public data model and client API as a pure-Python compatibility facade over the eggfetch Rust engine (
eggfetch.compat.httpx).What's Implemented
Value Objects
codes.OK = 200, etc.Request & Response
Client & AsyncClient
Exceptions
Top-level Helpers
Tests
407 new tests across 10 test files. 776 core Rust tests pass. Clippy and fmt clean.
Phase Status
See
plans/httpx-drop-in-phase-2-status.mdfor full acceptance criteria.