summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2023-12-06 18:28:12 +0100
committerSamantaz Fox <coding@samantaz.fr>2023-12-06 18:28:12 +0100
commit6da3287e9dad7e0eb8d767bce56e8e05c22f6f54 (patch)
treeb72bdbd5d689861b456b23afe63f4018e620d7e1 /src
parent37c2f5caeda3337baee0ddee29d1f2576cffaa65 (diff)
parent8338a73e7bc0585edd36bb7fcd4589e741ce0bab (diff)
downloadinvidious-6da3287e9dad7e0eb8d767bce56e8e05c22f6f54.tar.gz
invidious-6da3287e9dad7e0eb8d767bce56e8e05c22f6f54.tar.bz2
invidious-6da3287e9dad7e0eb8d767bce56e8e05c22f6f54.zip
Misc: Fix logic for setting user agent (#4265)
Diffstat (limited to 'src')
-rw-r--r--src/invidious/yt_backend/connection_pool.cr5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/invidious/yt_backend/connection_pool.cr b/src/invidious/yt_backend/connection_pool.cr
index 03ff0ee4..36e82766 100644
--- a/src/invidious/yt_backend/connection_pool.cr
+++ b/src/invidious/yt_backend/connection_pool.cr
@@ -1,7 +1,6 @@
def add_yt_headers(request)
- if request.headers["User-Agent"] == "Crystal"
- request.headers["User-Agent"] ||= "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
- end
+ request.headers.delete("User-Agent") if request.headers["User-Agent"] == "Crystal"
+ request.headers["User-Agent"] ||= "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
request.headers["Accept-Charset"] ||= "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
request.headers["Accept"] ||= "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"