From f89b8e197781eb822ce4303785be27226c473c97 Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 16 Jun 2025 01:11:38 +0200 Subject: [PATCH] Fix UserAgent RequestHeader: UserAgent should not be added after it already existed --- API/MangaDownloadClients/HttpDownloadClient.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/API/MangaDownloadClients/HttpDownloadClient.cs b/API/MangaDownloadClients/HttpDownloadClient.cs index cfe1753..7c53848 100644 --- a/API/MangaDownloadClients/HttpDownloadClient.cs +++ b/API/MangaDownloadClients/HttpDownloadClient.cs @@ -1,4 +1,5 @@ using System.Net; +using System.Net.Http.Headers; using HtmlAgilityPack; namespace API.MangaDownloadClients; @@ -13,7 +14,8 @@ internal class HttpDownloadClient : DownloadClient public HttpDownloadClient() { - Client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", TrangaSettings.userAgent); + if(Client.DefaultRequestHeaders.UserAgent.Count < 1) + Client.DefaultRequestHeaders.UserAgent.Add(new ("Tranga", "2.0")); } internal override RequestResult MakeRequestInternal(string url, string? referrer = null, string? clickButton = null)