[vlc-commits] [Git][videolan/vlc][3.0.x] http: allow short response byte range
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat May 11 16:17:38 UTC 2024
Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC
Commits:
d9b0f2b6 by Rémi Denis-Courmont at 2024-05-10T18:03:51+03:00
http: allow short response byte range
RFC9110 specifies that a client must handle a shorter response range
than requested in all circumstanges. Previously, RFC7233 only required
that behaviour for multipart ranges, which VLC did not use.
This matches the newer specification: VLC will try to resume from the
last received offset not only on unexpected error, but also on short
response.
Fixes #28627.
(cherry picked from commit 90dc0a023f6ceee591f6464367efae65f2ccf6e7)
- - - - -
1 changed file:
- modules/access/http/file.c
Changes:
=====================================
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;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d9b0f2b638fa78cec95ab5f39e855ab65dc3e83b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d9b0f2b638fa78cec95ab5f39e855ab65dc3e83b
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list