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

Frida setup.py doesn't honor https_proxy #99

Closed
doegox opened this issue Dec 28, 2016 · 1 comment
Closed

Frida setup.py doesn't honor https_proxy #99

doegox opened this issue Dec 28, 2016 · 1 comment

Comments

@doegox
Copy link
Contributor

doegox commented Dec 28, 2016

setup.py is querying for Frida prebuilds via xmlrpclib but xmlrpclib does not honor https_proxy:
https://github.com/frida/frida-python/blob/master/src/setup.py#L68

It's a problem similar to old versions of pip, cf pypa/pip#1104 .

One possible solution as you're already using urllib to fetch the actual files (and urllib is aware of https_proxy) is to use it as transport for xmlrpclib.

This snippet works with and without proxy, in python2 and python3:

import os
import sys
try:
    from urllib.request import urlopen, Request
except:
    from urllib2 import urlopen, Request
try:
    import xmlrpclib
except ImportError:
    import xmlrpc.client as xmlrpclib
    

class UrllibTransport(xmlrpclib.Transport):
    def __init__(self, *args, **argd):
        xmlrpclib.Transport.__init__(self, *args, **argd)
    def request(self, host, handler, request_body, verbose=0):
        self.verbose=verbose
        scheme = 'https'
        url = '%(scheme)s://%(host)s%(handler)s' % locals()
        req = Request(url, data=request_body, headers={'Content-Type':'text/xml'})
        fp = urlopen(req)
        return self.parse_response(fp)
client = xmlrpclib.ServerProxy("https://pypi.python.org/pypi", transport=UrllibTransport())


urls = client.release_urls("frida", "8.2.3")
urls = [url for url in urls if url['python_version'] != 'source']
print('\n'.join([u['url'] for u in urls]))
@oleavr oleavr closed this as completed in b098cf7 Jan 18, 2017
@oleavr
Copy link
Member

oleavr commented Jan 19, 2017

@doegox Thanks a lot! Your fix is now available in Frida 9.0.8.

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

No branches or pull requests

2 participants