diff options
| author | Samantaz Fox <coding@samantaz.fr> | 2023-01-17 22:30:38 +0100 |
|---|---|---|
| committer | Samantaz Fox <coding@samantaz.fr> | 2023-01-17 22:30:38 +0100 |
| commit | ce07f2cd4a45d2eecdbb68afcc457980058d316d (patch) | |
| tree | ba21a2acf3e787c2415e98ff4c3d36c99695ca14 | |
| parent | ea0d1b6f7bb2b2daa79c50735a0735a6d22a46d0 (diff) | |
| parent | 4ee483282e072473b618df1ce9a96668c2905cf5 (diff) | |
| download | invidious-ce07f2cd4a45d2eecdbb68afcc457980058d316d.tar.gz invidious-ce07f2cd4a45d2eecdbb68afcc457980058d316d.tar.bz2 invidious-ce07f2cd4a45d2eecdbb68afcc457980058d316d.zip | |
Video proxy: always include the 'range' header (#3570)
| -rw-r--r-- | src/invidious/routes/video_playback.cr | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/invidious/routes/video_playback.cr b/src/invidious/routes/video_playback.cr index 560f9c19..a0216cce 100644 --- a/src/invidious/routes/video_playback.cr +++ b/src/invidious/routes/video_playback.cr @@ -35,6 +35,13 @@ module Invidious::Routes::VideoPlayback end end + # See: https://github.com/iv-org/invidious/issues/3302 + range_header = env.request.headers["Range"]? + if range_header.nil? + range_for_head = query_params["range"]? || "0-640" + headers["Range"] = "bytes=#{range_for_head}" + end + client = make_client(URI.parse(host), region) response = HTTP::Client::Response.new(500) error = "" @@ -70,6 +77,9 @@ module Invidious::Routes::VideoPlayback end end + # Remove the Range header added previously. + headers.delete("Range") if range_header.nil? + if response.status_code >= 400 env.response.content_type = "text/plain" haltf env, response.status_code |
