diff --git a/v2rayN/ServiceLib/Handler/SubscriptionHandler.cs b/v2rayN/ServiceLib/Handler/SubscriptionHandler.cs index 22740842..30cd2c5c 100644 --- a/v2rayN/ServiceLib/Handler/SubscriptionHandler.cs +++ b/v2rayN/ServiceLib/Handler/SubscriptionHandler.cs @@ -82,7 +82,7 @@ public static class SubscriptionHandler private static DownloadService CreateDownloadHandler(string hashCode, Func updateFunc) { - var downloadHandle = new DownloadService(); + var downloadHandle = new DownloadService { AcceptHeader = "*/*" }; downloadHandle.Error += (sender2, args) => { updateFunc?.Invoke(false, $"{hashCode}{args.GetException().Message}"); diff --git a/v2rayN/ServiceLib/Services/DownloadService.cs b/v2rayN/ServiceLib/Services/DownloadService.cs index d93be690..2c548553 100644 --- a/v2rayN/ServiceLib/Services/DownloadService.cs +++ b/v2rayN/ServiceLib/Services/DownloadService.cs @@ -11,6 +11,8 @@ public class DownloadService public event ErrorEventHandler? Error; + public string? AcceptHeader { get; init; } + private static readonly string _tag = "DownloadService"; /// @@ -253,6 +255,10 @@ public class DownloadService userAgent = Utils.GetVersion(false); } client.DefaultRequestHeaders.UserAgent.TryParseAdd(userAgent); + if (AcceptHeader.IsNotEmpty()) + { + client.DefaultRequestHeaders.Accept.ParseAdd(AcceptHeader); + } Uri uri = new(url); //Authorization Header