summaryrefslogtreecommitdiffstats
path: root/module
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
parentfixed little bugs (diff)
downloadpyload-cbe4d60d401e4f2cedc38efb375ae38b40fb0c89.tar.xz
reconnect-, uploaded.to fix
Diffstat (limited to 'module')
-rwxr-xr-xmodule/network/Request.py21
-rw-r--r--module/thread_list.py8
2 files changed, 21 insertions, 8 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):
diff --git a/module/thread_list.py b/module/thread_list.py
index 3691c9f5e..778e2587d 100644
--- a/module/thread_list.py
+++ b/module/thread_list.py
@@ -108,6 +108,7 @@ class Thread_List(object):
elif pyfile.status.type == "reconnected":#put it back in queque
+ pyfile.plugin.req.init_curl()
self.list.files.insert(0, pyfile)
elif pyfile.status.type == "failed":
@@ -169,8 +170,11 @@ class Thread_List(object):
reconn = subprocess.Popen(self.parent.config['reconnect_method'])
reconn.wait()
time.sleep(1)
- ip = re.match(".*Current IP Address: (.*)</body>.*", urllib2.urlopen("http://checkip.dyndns.org/").read()).group(1) #versuchen neue ip aus zu lesen
+ ip = ""
while ip == "": #solange versuch bis neue ip ausgelesen
- ip = re.match(".*Current IP Address: (.*)</body>.*", urllib2.urlopen("http://checkip.dyndns.org/").read()).group(1)
+ try:
+ ip = re.match(".*Current IP Address: (.*)</body>.*", urllib2.urlopen("http://checkip.dyndns.org/").read()).group(1) #versuchen neue ip aus zu lesen
+ except:
+ ip = ""
time.sleep(1)
self.parent.logger.info("Reconnected, new IP: " + ip)