mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
Video proxy: always include the 'range' header (#3570)
This commit is contained in:
commit
ce07f2cd4a
1 changed files with 10 additions and 0 deletions
|
@ -35,6 +35,13 @@ module Invidious::Routes::VideoPlayback
|
||||||
end
|
end
|
||||||
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)
|
client = make_client(URI.parse(host), region)
|
||||||
response = HTTP::Client::Response.new(500)
|
response = HTTP::Client::Response.new(500)
|
||||||
error = ""
|
error = ""
|
||||||
|
@ -70,6 +77,9 @@ module Invidious::Routes::VideoPlayback
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Remove the Range header added previously.
|
||||||
|
headers.delete("Range") if range_header.nil?
|
||||||
|
|
||||||
if response.status_code >= 400
|
if response.status_code >= 400
|
||||||
env.response.content_type = "text/plain"
|
env.response.content_type = "text/plain"
|
||||||
haltf env, response.status_code
|
haltf env, response.status_code
|
||||||
|
|
Loading…
Reference in a new issue