diff options
author | mkaay <mkaay@mkaay.de> | 2010-05-10 15:43:10 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-05-10 15:43:10 +0200 |
commit | b08291a8981be4eb57fc628e1d205a0ce253a9b8 (patch) | |
tree | b4cc86962665352bb1a36fe61d5235b76f865238 | |
parent | captcha fix, webinterface dependency output, l18n (diff) | |
download | pyload-b08291a8981be4eb57fc628e1d205a0ce253a9b8.tar.xz |
new config option (outgoing intreface)
-rw-r--r-- | module/RequestFactory.py | 3 | ||||
-rw-r--r-- | module/config/core_default.xml | 1 | ||||
-rwxr-xr-x | module/network/Request.py | 5 |
3 files changed, 7 insertions, 2 deletions
diff --git a/module/RequestFactory.py b/module/RequestFactory.py index 37796be6c..e707ea6cd 100644 --- a/module/RequestFactory.py +++ b/module/RequestFactory.py @@ -30,7 +30,8 @@ class RequestFactory(): def getRequest(self, pluginName, account=None): self.lock.acquire() - req = Request() + iface = self.core.config["general"]["download_interface"] + req = Request(interface=str(iface)) cj = self.getCookieJar(pluginName, account) req.setCookieJar(cj) self.requests.append((pluginName, account, req)) diff --git a/module/config/core_default.xml b/module/config/core_default.xml index 783818502..c91c5d186 100644 --- a/module/config/core_default.xml +++ b/module/config/core_default.xml @@ -36,6 +36,7 @@ <checksum type="bool" name="Use Checksum">True</checksum> <min_free_space type="int" name="Min Free Space (MB)">200</min_free_space> <folder_per_package type="bool" name="Create folder for each package">False</folder_per_package> + <download_interface type="ip" name="Outgoing IP address for downloads"></download_interface> </general> <updates name="Updates"> <search_updates type="bool" name="Search">True</search_updates> diff --git a/module/network/Request.py b/module/network/Request.py index 733ab5851..1fb76d7e0 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -32,7 +32,7 @@ class AbortDownload(Exception): pass class Request: - def __init__(self): + def __init__(self, interface=None): self.dl_time = 0 self.dl_finished = 0 @@ -64,6 +64,7 @@ class Request: self.maxSpeed = 0 self.isSlow = False self.cookieJar = None + self.interface = interface # change this for connection information self.debug = False @@ -91,6 +92,8 @@ class Request: self.pycurl.setopt(pycurl.SSL_VERIFYPEER, 0) if self.debug: self.pycurl.setopt(pycurl.VERBOSE, 1) + if self.interface: + self.pycurl.setopt(pycurl.INTERFACE, self.interface) self.pycurl.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.10") |