Skip to content
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

Allow usage of proxies even when contacting localhost #1605

Merged
merged 1 commit into from Oct 25, 2016

Conversation

chalstrick
Copy link
Contributor

Sometimes it makes sense to use a proxy even when the remote host is localhost
or 127.0.0.1. git-lfs in contrast to e.g. native git does not allow to use a
proxy when talking to localhost. Remove this special treatment of localhost
and react only on http_proxy or no_proxy env variables.

My use case: I wanted to debug/analyze network traffic from a git client to the
git server and the lfs server running on my developer machine. I set up
mitmproxy [1] as a proxy server running on localhost and I set http_proxy to
point to mitmproxy. I was able to see all the traffic between the client and
the local git server in mitmproxy but the the communication between the client
and the lfs server was hidden because git-lfs ignored the proxy settings
because the hostname was localhost.

@technoweenie
Copy link
Contributor

This is a great use case 👍 You can fix the ci error by removing this line, which is no longer needed since this file is no longer using net.SplitHostPort() or net.ParseIP().

FWIW: script/fmt or script/test would have removed that line automatically if you have goimports installed.

@ttaylorr
Copy link
Contributor

After you fix the CI error this looks good to me 👍

@sschuberth
Copy link
Member

Since the code has been modified now, I wonder whether this comment should also go away.

@chalstrick
Copy link
Contributor Author

I updated the comment and cleaned the imports. Looks good for me now

@sschuberth
Copy link
Member

Looks good for me now

Except maybe for the missing dot at the end of the code comment :-D (Nitpick!)

Sometimes it makes sense to use a proxy even when the remote host is localhost
or 127.0.0.1. git-lfs in contrast to e.g. native git does not allow to use a
proxy when talking to localhost. Remove this special treatment of localhost
and react only on http_proxy or no_proxy env variables.

My use case: I wanted to debug/analyze network traffic from a git client to the
git server and the lfs server running on my developer machine. I set up
mitmproxy [1] as a proxy server running on localhost and I set http_proxy to
point to mitmproxy. I was able to see all the traffic between the client and
the local git server in mitmproxy but the the communication between the client
and the lfs server was hidden because git-lfs ignored the proxy settings
because the hostname was localhost.
@chalstrick
Copy link
Contributor Author

Agree, I added the missing dot

@technoweenie technoweenie merged commit ce8a5a9 into git-lfs:master Oct 25, 2016
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.

None yet

4 participants