-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor + Caching #404
Open
hazcod
wants to merge
95
commits into
elazarl:master
Choose a base branch
from
hazcod:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Refactor + Caching #404
Conversation
This file contains 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
Important changes: Fixes elazarl#256: connections are closed after usage, so FD-count remains congruent with the actual amount of open connections. Added ProxyHttpServer.Signer of type type Signer func(ca *tls.Certificate, hostname []string) (*tls.Certificate, error) If ProxyHttpServer.Signer is set, the goproxy uses that function to retrieve Certificates for TLS-interception. This allows consumers of goproxy to implement f.e. caching of certificates. Minor changes: - adjusted import-path to github.com/oec/goproxy - go fmt on all files
UrlHasPrefix did not add "://" between the url.Scheme and the url.Host so that the comparison against the given prefix would fail, if that starts with the usual URL syntax "scheme://host..."
Was commit ecfe977 from dmjones
After successful handshake in a HTTPS MITM scenario, it is not sufficient call http.ReadRequest(clientTLS). The body -or parts of it- might still be in the bufio.Buffer and not processed yet. The subsequent call to http.ReadRequest will than fail because it doesn't find a proper request-line in the buffer. This patch reads the complete body from the request and resets the bufio.Buffer so that the next call to http.ReadRequest() can work with a clean plate. [Unfortunately I haven't managed to create an test case for it as the http.Client seems to open new CONNECTs to access the test-TLS-server. Still working on it.]
When intercepting a CONNECT, we read the request from the client in a loop and create another request object. Before this commit, we had set the .Host of this new request with the .Host from the original CONNECT-request, which might contain a port number. Such a request to the outgoing server failed with 500. With this commit, the proxy does not set .Host anymore on the outgoing request (but still sets .URL.Host).
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.
Up for discussion, it's a collection of refactors/prs & bugfixes.
Some tests are broken.