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>
CQTexperiment
Christopher Snowhill 2022-02-04 22:03:22 -08:00
parent 3069a81d85
commit e0e7274339
1 changed files with 5 additions and 3 deletions

View File

@ -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;