diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-06-08 22:46:33 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-06-08 22:46:33 +0200 |
commit | 4745af09d1095ae8cb5f40e135b44ce430193139 (patch) | |
tree | 35a224eaf10dad60c1c94b3a5440f594c3948c5f /module/plugins | |
parent | [GamefrontCom] Update (diff) | |
download | pyload-4745af09d1095ae8cb5f40e135b44ce430193139.tar.xz |
[SimpleCrypter] Fix handleDirect loop
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 00b872b69..923775e32 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -11,7 +11,7 @@ from module.utils import fixup, html_unescape class SimpleCrypter(Crypter, SimpleHoster): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.51" + __version__ = "0.52" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package'] @@ -21,7 +21,6 @@ class SimpleCrypter(Crypter, SimpleHoster): __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - """ Following patterns should be defined by each crypter: @@ -53,9 +52,6 @@ class SimpleCrypter(Crypter, SimpleHoster): return the html of the page number page_n """ - LINK_PATTERN = None - - #@TODO: Remove in 0.4.10 def init(self): account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "") @@ -92,12 +88,17 @@ class SimpleCrypter(Crypter, SimpleHoster): def handleDirect(self, pyfile): - while True: - header = self.load(self.link or pyfile.url, just_header=True, decode=True) + for i in xrange(10): #@TODO: Use `pycurl.MAXREDIRS` value in 0.4.10 + redirect = self.link or pyfile.url + self.logDebug("Redirect #%d to: %s" % (i, redirect)) + + header = self.load(redirect, just_header=True, decode=True) if 'location' in header and header['location']: self.link = header['location'] else: break + else: + self.logError(_("Too many redirects")) def decrypt(self, pyfile): |