commit ce4bf8688ad56eb7e2811ad0f5ba0cb536c6dc00 Author: Arturo Filastò art@fuffa.org Date: Mon Jul 27 16:52:33 2015 +0200
Use the latest version of txsocksx that includes a fix for 15.0 --- ooni/reporter.py | 2 +- ooni/utils/hacks.py | 27 --------------------------- ooni/utils/trueheaders.py | 5 +++-- requirements.txt | 2 +- 4 files changed, 5 insertions(+), 31 deletions(-)
diff --git a/ooni/reporter.py b/ooni/reporter.py index 36a0e88..574cd1b 100644 --- a/ooni/reporter.py +++ b/ooni/reporter.py @@ -287,7 +287,7 @@ class OONIBReporter(OReporter): # do this with some deferred kung foo or instantiate the reporter after # tor is started.
- from ooni.utils.hacks import SOCKS5Agent + from txsocksx.http import SOCKS5Agent from twisted.internet import reactor
if self.collectorAddress.startswith('httpo://'): diff --git a/ooni/utils/hacks.py b/ooni/utils/hacks.py index e001d3f..7ec3d0f 100644 --- a/ooni/utils/hacks.py +++ b/ooni/utils/hacks.py @@ -58,30 +58,3 @@ def patched_reduce_ex(self, proto): return copy_reg._reconstructor, args, dict else: return copy_reg._reconstructor, args - - -class SOCKS5Agent(SOCKS5AgentOriginal): - """ - This is a quick hack to fix: - https://github.com/habnabit/txsocksx/issues/9 - """ - def _getEndpoint(self, scheme_or_uri, host=None, port=None): - if host is not None: - scheme = scheme_or_uri - else: - scheme = scheme_or_uri.scheme - host = scheme_or_uri.host - port = scheme_or_uri.port - if scheme not in ('http', 'https'): - raise SchemeNotSupported('unsupported scheme', scheme) - endpoint = self.endpointFactory( - host, port, self.proxyEndpoint, **self.endpointArgs) - if scheme == 'https': - if hasattr(self, '_wrapContextFactory'): - tlsPolicy = self._wrapContextFactory(host, port) - elif hasattr(self, '_policyForHTTPS'): - tlsPolicy = self._policyForHTTPS.creatorForNetloc(host, port) - else: - raise NotImplementedError("can't figure out how to make a context factory") - endpoint = self._tlsWrapper(tlsPolicy, endpoint) - return endpoint diff --git a/ooni/utils/trueheaders.py b/ooni/utils/trueheaders.py index f015b62..3905949 100644 --- a/ooni/utils/trueheaders.py +++ b/ooni/utils/trueheaders.py @@ -8,11 +8,12 @@ import itertools from copy import copy
from twisted.web import client, _newclient, http_headers -from twisted.web._newclient import RequestNotSent, RequestGenerationFailed, TransportProxyProducer, STATUS +from twisted.web._newclient import RequestNotSent, RequestGenerationFailed +from twisted.web._newclient import TransportProxyProducer, STATUS from twisted.internet import reactor from twisted.internet.defer import Deferred, fail, maybeDeferred, failure
-from ooni.utils.hacks import SOCKS5Agent +from txsocksx.http import SOCKS5Agent from txsocksx.client import SOCKS5ClientFactory
SOCKS5ClientFactory.noisy = False diff --git a/requirements.txt b/requirements.txt index 50e82f2..8b8d5ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ PyYAML>=3.10 -Twisted>=12.2.0,<=14.0.0 +Twisted>=12.2.0 ipaddr>=2.1.10 pyOpenSSL>=0.13 geoip
tor-commits@lists.torproject.org