diff --git a/Plugins/HTTPSource/HTTPSource.h b/Plugins/HTTPSource/HTTPSource.h index 95e77c9c1..155fba32e 100644 --- a/Plugins/HTTPSource/HTTPSource.h +++ b/Plugins/HTTPSource/HTTPSource.h @@ -31,6 +31,7 @@ long _bytesBuffered; long _byteCount; + BOOL taskSuspended; NSString *_mimeType; } diff --git a/Plugins/HTTPSource/HTTPSource.m b/Plugins/HTTPSource/HTTPSource.m index 79688afbe..c9da7aac0 100644 --- a/Plugins/HTTPSource/HTTPSource.m +++ b/Plugins/HTTPSource/HTTPSource.m @@ -104,6 +104,7 @@ } if (bytesBuffered >= BUFFER_SIZE) { [task suspend]; + taskSuspended = YES; } } @@ -182,6 +183,7 @@ didCompleteWithError:(NSError *)error{ didReceiveResponse = NO; didReceiveRandomData = NO; redirected = NO; + taskSuspended = NO; redirectURLs = [[NSMutableArray alloc] init]; bufferedData = [[NSMutableData alloc] init]; @@ -262,8 +264,9 @@ didCompleteWithError:(NSError *)error{ bytesBuffered = _bytesBuffered; } - if (!didComplete && bytesBuffered <= (BUFFER_SIZE * 3 / 4)) { + if (!didComplete && taskSuspended && bytesBuffered <= (BUFFER_SIZE * 3 / 4)) { [task resume]; + taskSuspended = NO; } totalRead += amountReceived;