Use lower level TCP for registry proxy - #26
Merged
Conversation
alexcb
approved these changes
Oct 3, 2023
alexcb
left a comment
Contributor
There was a problem hiding this comment.
looks good, please rebase your commits prior to merging.
mikejholly
force-pushed
the
mh/regproxy-v2
branch
from
October 3, 2023 20:52
ecef674 to
f3b4f01
Compare
mikejholly
added a commit
to earthly/earthly
that referenced
this pull request
Oct 3, 2023
Removes the HTTP-level code in favor of a lower-level TCP proxy approach. The tricky part here was that Docker (and most HTTP clients) leaves the TCP connection open. Hence, there's no way for the code to detect when to stop reading the initial request aside from a timeout. Apparently, the recommended approach is to set [`SetReadDeadline`](https://cs.opensource.google/go/go/+/refs/tags/go1.21.1:src/net/net.go;l=156) ahead of each read and appropriately handle any timeout errors. Overall, I think this is preferable to the original code as the HTTP code & header parsing is a bit brittle. Works with: earthly/buildkit#26
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.
Simplifies the registry proxying code by removing the HTTP client & header parsing in favor of lower-level data copying.
Works with earthly/earthly#3317.