summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/network
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/network')
-rw-r--r--pyload/plugins/network/CurlChunk.py2
-rw-r--r--pyload/plugins/network/CurlDownload.py8
-rw-r--r--pyload/plugins/network/CurlRequest.py3
3 files changed, 8 insertions, 5 deletions
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")