@@ -75,16 +75,16 @@ module Invidious::Routes::VideoPlayback
7575 end
7676
7777 begin
78- client.get(url, headers) do |response |
79- response .headers.each do |key , value |
78+ client.get(url, headers) do |resp |
79+ resp .headers.each do |key , value |
8080 if ! RESPONSE_HEADERS_BLACKLIST .includes?(key.downcase)
8181 env.response.headers[key] = value
8282 end
8383 end
8484
8585 env.response.headers[" Access-Control-Allow-Origin" ] = " *"
8686
87- if location = response .headers[" Location" ]?
87+ if location = resp .headers[" Location" ]?
8888 location = URI .parse(location)
8989 location = " #{ location.request_target } &host=#{ location.host } "
9090
@@ -95,7 +95,7 @@ module Invidious::Routes::VideoPlayback
9595 return env.redirect location
9696 end
9797
98- IO .copy(response .body_io, env.response)
98+ IO .copy(resp .body_io, env.response)
9999 end
100100 rescue ex
101101 end
@@ -132,23 +132,23 @@ module Invidious::Routes::VideoPlayback
132132 headers[" Range" ] = " bytes=#{ chunk_start } -#{ chunk_end } "
133133
134134 begin
135- client.get(url, headers) do |response |
135+ client.get(url, headers) do |resp |
136136 if first_chunk
137- if ! env.request.headers[" Range" ]? && response .status_code == 206
137+ if ! env.request.headers[" Range" ]? && resp .status_code == 206
138138 env.response.status_code = 200
139139 else
140- env.response.status_code = response .status_code
140+ env.response.status_code = resp .status_code
141141 end
142142
143- response .headers.each do |key , value |
143+ resp .headers.each do |key , value |
144144 if ! RESPONSE_HEADERS_BLACKLIST .includes?(key.downcase) && key.downcase != " content-range"
145145 env.response.headers[key] = value
146146 end
147147 end
148148
149149 env.response.headers[" Access-Control-Allow-Origin" ] = " *"
150150
151- if location = response .headers[" Location" ]?
151+ if location = resp .headers[" Location" ]?
152152 location = URI .parse(location)
153153 location = " #{ location.request_target } &host=#{ location.host } #{ region ? " ®ion=#{ region } " : " " } "
154154
@@ -161,8 +161,8 @@ module Invidious::Routes::VideoPlayback
161161 env.response.headers[" Content-Disposition" ] = " attachment; filename=\" #{ URI .encode_www_form(title)} \" ; filename*=UTF-8''#{ URI .encode_www_form(title)} "
162162 end
163163
164- if ! response .headers.includes_word?(" Transfer-Encoding" , " chunked" )
165- content_length = response .headers[" Content-Range" ].split(" /" )[-1 ].to_i64
164+ if ! resp .headers.includes_word?(" Transfer-Encoding" , " chunked" )
165+ content_length = resp .headers[" Content-Range" ].split(" /" )[-1 ].to_i64
166166 if env.request.headers[" Range" ]?
167167 env.response.headers[" Content-Range" ] = " bytes #{ range_start } -#{ range_end || (content_length - 1 ) } /#{ content_length } "
168168 env.response.content_length = ((range_end.try & .+ 1 ) || content_length) - range_start
@@ -172,7 +172,7 @@ module Invidious::Routes::VideoPlayback
172172 end
173173 end
174174
175- proxy_file(response , env)
175+ proxy_file(resp , env)
176176 end
177177 rescue ex
178178 if ex.message != " Error reading socket: Connection reset by peer"
0 commit comments