mirror of
https://github.com/munki/munki.git
synced 2026-05-02 18:30:03 -05:00
Keep content-length on network connection error so downloads can resume (#1057)
Gurl requires the expected content length in the xattr data in order to consider resuming a partial download. When there is a network connection interruption URLSession_task_didCompleteWithError_ is called with an error. Prior to this fix content length was always removed from the xattr data when URLSession_task_didCompleteWithError_ was called so downloads would never resume after a connection error. With this fix, content length is only removed from the xattr data when there is no error since the download would be complete and resuming would not be necessary.
This commit is contained in:
@@ -383,9 +383,10 @@ class Gurl(NSObject):
|
||||
'''NSURLSessionTaskDelegate method.'''
|
||||
if self.destination and self.destination_path:
|
||||
self.destination.close()
|
||||
self.removeExpectedSizeFromStoredHeaders()
|
||||
if error:
|
||||
self.recordError_(error)
|
||||
else:
|
||||
self.removeExpectedSizeFromStoredHeaders()
|
||||
self.done = True
|
||||
|
||||
def connection_didFailWithError_(self, _connection, error):
|
||||
|
||||
Reference in New Issue
Block a user