From 7aada3f328f6e62fc0a460576509c865af3cce30 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 10 Oct 2019 23:45:46 -0400 Subject: [PATCH] Avoid override for X-Client headers --- src/invidious/helpers/proxy.cr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/invidious/helpers/proxy.cr b/src/invidious/helpers/proxy.cr index 388d6827..0ba3c1fe 100644 --- a/src/invidious/helpers/proxy.cr +++ b/src/invidious/helpers/proxy.cr @@ -89,9 +89,9 @@ class HTTPClient < HTTP::Client def exec(request) if self.host == "www.youtube.com" - request.headers["x-youtube-client-name"] = "1" - request.headers["x-youtube-client-version"] = "2.20180719" - request.headers["user-agent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" + request.headers["x-youtube-client-name"] ||= "1" + request.headers["x-youtube-client-version"] ||= "1.20180719" + request.headers["user-agent"] ||= "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" end super