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

Proxy support for the agent #377

Merged
merged 37 commits into from
Feb 20, 2013
Merged

Proxy support for the agent #377

merged 37 commits into from
Feb 20, 2013

Conversation

remh
Copy link
Contributor

@remh remh commented Feb 15, 2013

If the forwarder is installed, it uses tornado's CurlAsyncHttpClient
CurlAsyncHttpClient requires PyCurl which is not easily installable from source.
Therefore proxy support won't be working on source installation of the agent

If the forwarder is not used it uses urllib2 in the emitter.
Warning:

  • urllib2 has a bug on python < 2.6.3, this is why we bundle a patched version of urllib2 and httplib that will be used in case of connection through a proxy with python 2.6.3
  • I added another patch to handle proxy authentication for SSL connections

It has been tested on:

  • Windows
  • CentOS 5
  • CentOS 6
  • Ubuntu 10.04
  • Ubuntu 12.04

DogstatsD doens't implement proxy support as it's local traffic in most cases.

…on 2.4

Change the emitter to configure proxy if needed
Refactor proxy settings fetch
@remh remh closed this Feb 15, 2013
@remh remh reopened this Feb 15, 2013
@ghost ghost assigned alq666 Feb 15, 2013
proxies = urllib.getproxies()
proxy = proxies.get('https', None)
try:
proxy = proxy.split('://')[1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use urlparse instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

urlparse is not great (at least on old python versions)

>>> urlparse('https://user:password@host:1234')
('https', 'user:password@host:1234', '', '', '', '')
>>> urlparse('user:password@host:1234')
('user', '', 'password@host:1234', '', '', '')

So I'm going to keep this parsing.

@conorbranagan
Copy link
Member

Looks great! My only question is: are there any licenses we need to include for the 3rd-party stuff we're packaging?

@remh
Copy link
Contributor Author

remh commented Feb 15, 2013

I didn't see any:
I got the patched versions of httplib and urllib here http://pypi.python.org/pypi/httpsproxy_urllib2 and here: http://bugs.python.org/issue7291

@conorbranagan
Copy link
Member

Ah cool, I didn't realize it was just a patch to stdlib python. Sweet!

alq666 added a commit that referenced this pull request Feb 20, 2013
Proxy support for the agent
@alq666 alq666 merged commit cf9532e into master Feb 20, 2013
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

5 participants