diff --git a/modules/access/http/file.c b/modules/access/http/file.c index ce101f60d6..5a5d4622a1 100644 --- a/modules/access/http/file.c +++ b/modules/access/http/file.c @@ -235,20 +235,21 @@ block_t *vlc_http_file_read(struct vlc_http_resource *res) block_t *block = vlc_http_res_read(res); if (block == vlc_http_error) - { /* Automatically reconnect on error if server supports seek */ - if (res->response != NULL - && vlc_http_msg_can_seek(res->response) - && file->offset < vlc_http_msg_get_file_size(res->response) - && vlc_http_file_seek(res, file->offset) == 0) - block = vlc_http_res_read(res); + block = NULL; + + /* Automatically resume on short response or error if possible */ + if (block == NULL && res->response != NULL + && vlc_http_msg_can_seek(res->response) + && file->offset < vlc_http_msg_get_file_size(res->response) + && vlc_http_file_seek(res, file->offset) == 0) + { + block = vlc_http_res_read(res); if (block == vlc_http_error) - return NULL; + block = NULL; /* Non-recovered error */ } - if (block == NULL) - return NULL; /* End of stream */ - - file->offset += block->i_buffer; + if (block != NULL) + file->offset += block->i_buffer; return block; }