summaryrefslogtreecommitdiffstats
path: root/module/network/HTTPRequest.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-05-12 21:57:53 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-05-12 21:57:53 +0200
commite269bec1053f059ba0fd701c1e7fa1ad424726bc (patch)
tree70e4ddb3578f7eef435ed563a9d6b7f9bbd9ddbb /module/network/HTTPRequest.py
parentfixed js (diff)
downloadpyload-e269bec1053f059ba0fd701c1e7fa1ad424726bc.tar.xz
some fixes, closed #306
Diffstat (limited to 'module/network/HTTPRequest.py')
-rw-r--r--module/network/HTTPRequest.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/module/network/HTTPRequest.py b/module/network/HTTPRequest.py
index f0a80fd93..598be78c7 100644
--- a/module/network/HTTPRequest.py
+++ b/module/network/HTTPRequest.py
@@ -34,7 +34,7 @@ class BadHeader(Exception):
class HTTPRequest():
- def __init__(self, cookies=None, interface=None, proxies=None):
+ def __init__(self, cookies=None, options=None):
self.c = pycurl.Curl()
self.rep = StringIO()
@@ -50,7 +50,7 @@ class HTTPRequest():
self.headers = [] #temporary request header
self.initHandle()
- self.setInterface(interface, proxies)
+ self.setInterface(options["interface"], options["proxies"], options["ipv6"])
self.c.setopt(pycurl.WRITEFUNCTION, self.write)
self.c.setopt(pycurl.HEADERFUNCTION, self.writeHeader)
@@ -80,7 +80,7 @@ class HTTPRequest():
"Connection: keep-alive",
"Keep-Alive: 300"])
- def setInterface(self, interface, proxy):
+ def setInterface(self, interface, proxy, ipv6=False):
if interface and interface.lower() != "none":
self.c.setopt(pycurl.INTERFACE, str(interface))
@@ -98,6 +98,11 @@ class HTTPRequest():
if proxy["username"]:
self.c.setopt(pycurl.PROXYUSERPWD, "%s:%s" % (proxy["username"], proxy["password"]))
+ if ipv6:
+ self.c.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_WHATEVER)
+ else:
+ self.c.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_V4)
+
def addCookies(self):
""" put cookies from curl handle to cj """
if self.cj: