fix: fix upstream sync and adopt python-dxf#17
Merged
davidpoblador merged 3 commits intomainfrom Apr 2, 2026
Merged
Conversation
The httpx client was configured with follow_redirects=True globally and http2=True. On 301/302 redirects, HTTP spec allows clients to change POST to GET, which means the upload session POST never actually creates a session. The subsequent PUT then returns 404. Fix: remove http2 (unnecessary, known issues with some registries), remove global follow_redirects, and add it only to GET/HEAD operations (pulls) where CDN redirects are expected. POST/PUT operations (pushes) now use the default follow_redirects=False. Also cleans up dead code: no-op URL conditional in push_blob and unnecessary async generator wrapper in push_blob_streaming. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adopt python-dxf for all upstream registry v2 operations. This replaces the manual httpx POST/PUT blob upload flow (which was broken by redirect handling) with a battle-tested library that correctly implements the Docker registry protocol. - UpstreamClient now creates per-repo DXF instances, cached for reuse - All sync DXF calls wrapped with asyncio.to_thread (same pattern as storage) - push_blob_streaming collects the async stream then delegates to DXF - pull_blob yields chunks via to_thread(next, ...) for async streaming - Moved httpx from main deps to dev-only (still needed for Starlette TestClient) - Swapped respx for responses in test mocks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Docker resolves localhost to ::1 (IPv6) on macOS and connects there first. Binding to :: instead of 0.0.0.0 accepts both IPv4 and IPv6 connections. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
http2=Trueand restrictingfollow_redirectsto GET/HEAD only (POST/PUT were subject to 301/302 method change)python-dxf, a battle-tested Docker registry v2 libraryTest plan
transcriptunermarkers🤖 Generated with Claude Code