Check if replies are open in downloads.

This commit is contained in:
Florian Bruhin 2014-12-01 07:35:57 +01:00
parent f22c00c64d
commit 316d5ff189

View File

@ -419,6 +419,8 @@ class DownloadItem(QObject):
# got a readyRead after the reply was finished (which happens on
# qute:log for example).
return
if not self.reply.isOpen():
raise IOError("Reply is closed!")
try:
self.fileobj.write(self.reply.readAll())
except OSError as e:
@ -435,6 +437,8 @@ class DownloadItem(QObject):
@pyqtSlot()
def on_read_timer_timeout(self):
"""Read some bytes from the QNetworkReply periodically."""
if not self.reply.isOpen():
raise IOError("Reply is closed!")
self._buffer.write(self.reply.read(1024))
def _handle_redirect(self):