diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-08-01 19:16:24 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-08-01 19:16:37 +0200 |
commit | da829af5930917a18f5d01b57ffdae7c98db1ff8 (patch) | |
tree | 36cd2ecea3a83b08279a84c6974a3313b465e80f /pyload | |
parent | Adapted 6 multi hoster plugins (diff) | |
download | pyload-da829af5930917a18f5d01b57ffdae7c98db1ff8.tar.xz |
fixed cookie passing, new test cases
Diffstat (limited to 'pyload')
-rw-r--r-- | pyload/plugins/Hoster.py | 2 | ||||
-rw-r--r-- | pyload/plugins/network/CurlChunk.py | 2 | ||||
-rw-r--r-- | pyload/plugins/network/CurlDownload.py | 8 | ||||
-rw-r--r-- | pyload/plugins/network/CurlRequest.py | 3 |
4 files changed, 9 insertions, 6 deletions
diff --git a/pyload/plugins/Hoster.py b/pyload/plugins/Hoster.py index a37102aff..44b10899d 100644 --- a/pyload/plugins/Hoster.py +++ b/pyload/plugins/Hoster.py @@ -294,7 +294,7 @@ class Hoster(Base): try: # TODO: hardcoded arguments newname = self.dl.download(url, filename, get=get, post=post, referer=ref, chunks=self.getChunkCount(), - resume=self.resumeDownload, disposition=disposition) + resume=self.resumeDownload, cookies=cookies, disposition=disposition) finally: self.dl.close() self.pyfile.size = self.dl.size diff --git a/pyload/plugins/network/CurlChunk.py b/pyload/plugins/network/CurlChunk.py index 4250db2ce..f5a19eb0d 100644 --- a/pyload/plugins/network/CurlChunk.py +++ b/pyload/plugins/network/CurlChunk.py @@ -164,7 +164,7 @@ class CurlChunk(CurlRequest): def getHandle(self): """ returns a Curl handle ready to use for perform/multiperform """ - self.setRequestContext(self.p.url, self.p.get, self.p.post, self.p.referer, self.cj) + self.setRequestContext(self.p.url, self.p.get, self.p.post, self.p.referer, self.p.cookies) self.c.setopt(pycurl.WRITEFUNCTION, self.writeBody) self.c.setopt(pycurl.HEADERFUNCTION, self.writeHeader) diff --git a/pyload/plugins/network/CurlDownload.py b/pyload/plugins/network/CurlDownload.py index 5de83ec7b..985513691 100644 --- a/pyload/plugins/network/CurlDownload.py +++ b/pyload/plugins/network/CurlDownload.py @@ -24,6 +24,7 @@ from shutil import move import pycurl from pyload.plugins.Base import Abort +from pyload.network.CookieJar import CookieJar from pyload.utils.fs import save_join, fs_encode from ..Download import Download @@ -38,6 +39,8 @@ class CurlDownload(Download): # def __init__(self, url, filename, get={}, post={}, referer=None, cj=None, bucket=None, # options={}, disposition=False): + CONTEXT_CLASS = CookieJar + def __init__(self, *args, **kwargs): Download.__init__(self, *args, **kwargs) @@ -108,7 +111,7 @@ class CurlDownload(Download): except IOError: self.info = ChunkInfo(self.path) - def download(self, uri, path, get={}, post={}, referer=True, disposition=False, chunks=1, resume=False): + def download(self, uri, path, get={}, post={}, referer=True, disposition=False, chunks=1, resume=False, cookies=True): """ returns new filename or None """ self.url = uri self.path = path @@ -116,6 +119,7 @@ class CurlDownload(Download): self.get = get self.post = post self.referer = referer + self.cookies = cookies self.checkResume() chunks = max(1, chunks) @@ -317,7 +321,5 @@ class CurlDownload(Download): if hasattr(self, "m"): self.m.close() del self.m - if hasattr(self, "cj"): - del self.cj if hasattr(self, "info"): del self.info
\ No newline at end of file diff --git a/pyload/plugins/network/CurlRequest.py b/pyload/plugins/network/CurlRequest.py index e5adc8be1..775c98522 100644 --- a/pyload/plugins/network/CurlRequest.py +++ b/pyload/plugins/network/CurlRequest.py @@ -177,7 +177,8 @@ class CurlRequest(Request): self.c.setopt(pycurl.REFERER, "") if cookies: - self.c.setopt(pycurl.COOKIELIST, self.cj.output()) + for c in self.cj.output().splitlines(): + self.c.setopt(pycurl.COOKIELIST, c) else: # Magic string that erases all cookies self.c.setopt(pycurl.COOKIELIST, "ALL") |