[HTTP Reader] Fix reading small static files

The reader was previously returning a failure state on open if the read
completed and fit entirely into the read buffer, which broke most remote
M3U or PLS playlists.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
main
Christopher Snowhill 2022-07-11 19:39:24 -07:00
parent 32940d3277
commit fc1a226791
1 changed files with 2 additions and 2 deletions

View File

@ -528,12 +528,12 @@ static void http_stream_reset(HTTPSource *fp) {
curl_slist_free_all(headers); curl_slist_free_all(headers);
curl_slist_free_all(ok_aliases); curl_slist_free_all(ok_aliases);
} }
self->curl = NULL;
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
[mutex lock]; [mutex lock];
if(self->status == STATUS_ABORTED) { if(self->status == STATUS_ABORTED) {
DLog(@"curl: thread ended due to abort signal"); DLog(@"curl: thread ended due to abort signal");
self->curl = NULL;
} else { } else {
DLog(@"curl: thread ended normally"); DLog(@"curl: thread ended normally");
self->status = STATUS_FINISHED; self->status = STATUS_FINISHED;
@ -731,7 +731,7 @@ static void http_stream_reset(HTTPSource *fp) {
- (void)close { - (void)close {
need_abort = YES; need_abort = YES;
content_type = nil; content_type = nil;
while(curl != NULL) { while(curl != NULL && status != STATUS_FINISHED) {
usleep(3000); usleep(3000);
} }
} }