summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/PluginThread.py6
-rw-r--r--module/network/HTTPBase.py11
2 files changed, 10 insertions, 7 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index f008475c5..0e7594d3a 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -221,7 +221,9 @@ class DownloadThread(PluginThread):
code = 0
msg = e.args
- if code in (7, 18, 28, 52, 56):
+ self.m.log.debug("Urllib error %s: %s" % (code, msg))
+
+ if code in (7, 18, 28, 52, 56, 104):
self.m.log.warning(_("Couldn't connect to host or connection resetted waiting 1 minute and retry."))
wait = time() + 60
while time() < wait:
@@ -242,7 +244,7 @@ class DownloadThread(PluginThread):
else:
pyfile.setStatus("failed")
- self.m.log.error("pycurl error %s: %s" % (code, msg))
+ self.m.log.error("Urllib error %s: %s" % (code, msg))
if self.m.core.debug:
print_exc()
self.writeDebugReport(pyfile)
diff --git a/module/network/HTTPBase.py b/module/network/HTTPBase.py
index 637d4ad7e..2737fd33c 100644
--- a/module/network/HTTPBase.py
+++ b/module/network/HTTPBase.py
@@ -21,21 +21,19 @@ from urllib import urlencode
from urllib2 import Request
from urllib2 import OpenerDirector
-
from urllib2 import HTTPHandler
from urllib2 import HTTPSHandler
from urllib2 import HTTPDefaultErrorHandler
from urllib2 import HTTPErrorProcessor
from urllib2 import ProxyHandler
-
from urllib2 import URLError
-
from urllib2 import _parse_proxy
from httplib import HTTPConnection
from httplib import HTTPResponse
from httplib import responses as HTTPStatusCodes
from httplib import ResponseNotReady
+from httplib import BadStatusLine
from CookieJar import CookieJar
from CookieRedirectHandler import CookieRedirectHandler
@@ -214,11 +212,14 @@ class PyLoadHTTPHandler(HTTPHandler):
if not h is None:
try:
self._start_connection(h, req)
- except socket.error, e:
+ except socket.error:
+ r = None
+ except BadStatusLine:
r = None
else:
try: r = h.getresponse()
- except ResponseNotReady, e: r = None
+ except ResponseNotReady: r = None
+ except BadStatusLine: r = None
if r is None or r.version == 9:
# httplib falls back to assuming HTTP 0.9 if it gets a