Retry on any 5xx server error
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sun, 3 Oct 2010 09:05:20 +0000 (11:05 +0200)
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sun, 31 Oct 2010 10:28:41 +0000 (11:28 +0100)
youtube-dl

index 54881a4d8a8f524b07a369b4988f1662428f6278..48258419f31f6b31cbf4e88a8b52e7f5af1f61b6 100755 (executable)
@@ -529,7 +529,7 @@ class FileDownloader(object):
                                data = urllib2.urlopen(request)
                                break
                        except (urllib2.HTTPError, ), err:
-                               if err.code != 500 and err.code != 503 and err.code != 416:
+                               if (err.code < 500 or err.code >= 600) and err.code != 416:
                                        # Unexpected HTTP error
                                        raise
                                elif err.code == 416:
@@ -539,7 +539,7 @@ class FileDownloader(object):
                                                data = urllib2.urlopen(basic_request)
                                                content_length = data.info()['Content-Length']
                                        except (urllib2.HTTPError, ), err:
-                                               if err.code != 503 and err.code != 500:
+                                               if err.code < 500 or err.code >= 600:
                                                        raise
                                        else:
                                                # Examine the reported length