summaryrefslogtreecommitdiffstats
path: root/module/network/Request.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-08-16 17:29:36 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-08-16 17:29:36 +0200
commitcbe4d60d401e4f2cedc38efb375ae38b40fb0c89 (patch)
treefb8cb7befb09b55d738ab483025f627eb3f0059d /module/network/Request.py
parentfixed little bugs (diff)
downloadpyload-cbe4d60d401e4f2cedc38efb375ae38b40fb0c89.tar.xz
reconnect-, uploaded.to fix
Diffstat (limited to 'module/network/Request.py')
-rwxr-xr-xmodule/network/Request.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/module/network/Request.py b/module/network/Request.py
index ccf12e756..0427bbe25 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -163,9 +163,12 @@ class Request:
def add_auth(self, user, pw):
- # @TODO: pycurl auth
-
- self.downloader.addheaders.append(['Authorization', 'Basic ' + base64.encodestring(user + ':' + pw)[:-1]])
+ if self.curl:
+ self.pycurl.setopt(pycurl.USERNAME, user)
+ self.pycurl.setopt(pycurl.PASSWORD, pw)
+ self.pycurl.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_ANY)
+ else:
+ self.downloader.addheaders.append(['Authorization', 'Basic ' + base64.encodestring(user + ':' + pw)[:-1]])
def add_cookies(self, req):
cookie_head = ""
@@ -182,9 +185,15 @@ class Request:
del self.cookies[:]
def add_proxy(self, protocol, adress):
- handler = urllib2.ProxyHandler({protocol: adress})
- self.opener.add_handler(handler)
- self.downloader.add_handler(handler)
+
+ # @TODO: pycurl proxy protocoll selection
+ if self.curl:
+ self.pycurl.setopt(pycurl.PROXY, adress.split(":")[0])
+ self.pycurl.setopt(pycurl.PROXYPORT, adress.split(":")[1])
+ else:
+ handler = urllib2.ProxyHandler({protocol: adress})
+ self.opener.add_handler(handler)
+ self.downloader.add_handler(handler)
def download(self, url, filename, get={}, post={}, ref=True, cookies=False):