projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ab0eda9
)
[downloader/http] Fix crash during urlopen caused by missing reason of URLError
author
Sergey M․
<dstftw@gmail.com>
Fri, 20 Nov 2020 21:22:21 +0000
(
04:22
+0700)
committer
Sergey M․
<dstftw@gmail.com>
Fri, 20 Nov 2020 21:22:21 +0000
(
04:22
+0700)
youtube_dl/downloader/http.py
patch
|
blob
|
history
diff --git
a/youtube_dl/downloader/http.py
b/youtube_dl/downloader/http.py
index 96379caf1ec2f462c7aadfaa02589778ba07e548..d8ac41dcc13b80c98808c0d538dfa3b146640ced 100644
(file)
--- a/
youtube_dl/downloader/http.py
+++ b/
youtube_dl/downloader/http.py
@@
-109,7
+109,9
@@
class HttpFD(FileDownloader):
try:
ctx.data = self.ydl.urlopen(request)
except (compat_urllib_error.URLError, ) as err:
- if isinstance(err.reason, socket.timeout):
+ # reason may not be available, e.g. for urllib2.HTTPError on python 2.6
+ reason = getattr(err, 'reason', None)
+ if isinstance(reason, socket.timeout):
raise RetryDownload(err)
raise err
# When trying to resume, Content-Range HTTP header of response has to be checked