diff options
author | Hadrien Theveneau <theveneau@gmail.com> | 2015-10-28 02:53:26 +0100 |
---|---|---|
committer | Hadrien Theveneau <theveneau@gmail.com> | 2015-10-28 02:53:26 +0100 |
commit | 7eb0e3f633343b7e96053fdfd0342a5f4da50952 (patch) | |
tree | 011865af5293e14fa0178cf3115e8871f01e6bbc /module | |
parent | Show key in debug log in DlProtectCom.py (diff) | |
download | pyload-7eb0e3f633343b7e96053fdfd0342a5f4da50952.tar.xz |
Infinite redirect bug fixing in SimpleCrypter.py
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index f37323f90..b36c3d528 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -149,24 +149,26 @@ class SimpleCrypter(Crypter): def handle_direct(self, pyfile): - link = None + redirect = None maxredirs = self.get_config("maxredirs", default=10, plugin="UserAgentSwitcher") for i in xrange(maxredirs): - url = link or pyfile.url - self.log_debug("Redirect #%d to: %s" % (i, url)) + redirect = redirect or pyfile.url + self.log_debug("Redirect #%d to: %s" % (i, redirect)) - header = self.load(url, just_header=True) + data = self.load(redirect) + header = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", self.req.http.header)) + #Ugly, but there is no direct way to fetch headers AND data location = header.get('location') if location: - link = location - - elif link: - self.links.append(link) + redirect = location + else: + self.data = data + self.links.extend(self.get_links()) return else: - self.log_warning(_("Too many redirects")) + self.log_error(_("Too many redirects")) def preload(self): |