HTTP Reader: Fix opening really tiny files
Tiny files complete fetching within the scope of the open function, so the URL session task would have completed already. Now the function will accept the data, and allow reading it. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
3069a81d85
commit
e0e7274339
1 changed files with 5 additions and 3 deletions
|
@ -200,7 +200,7 @@ didCompleteWithError:(NSError *)error{
|
|||
while (task && !didReceiveResponse)
|
||||
usleep(1000);
|
||||
|
||||
if (!task) return NO;
|
||||
if (!task && !didReceiveResponse) return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
@ -228,8 +228,10 @@ didCompleteWithError:(NSError *)error{
|
|||
|
||||
- (long)read:(void *)buffer amount:(long)amount
|
||||
{
|
||||
if (didComplete)
|
||||
return 0;
|
||||
@synchronized (bufferedData) {
|
||||
if (didComplete && ![bufferedData length])
|
||||
return 0;
|
||||
}
|
||||
|
||||
long totalRead = 0;
|
||||
long bytesBuffered = 0;
|
||||
|
|
Loading…
Reference in a new issue