[vlc-commits] [Git][videolan/vlc][master] http: allow short response byte range
Konstantin Pavlov (@thresh)
gitlab at videolan.org
Wed May 8 02:54:26 UTC 2024
Konstantin Pavlov pushed to branch master at VideoLAN / VLC
Commits:
90dc0a02 by Rémi Denis-Courmont at 2024-05-07T13:38:39+00: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.
- - - - -
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/90dc0a023f6ceee591f6464367efae65f2ccf6e7
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/90dc0a023f6ceee591f6464367efae65f2ccf6e7
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