From 9451b69246ce3aca0feeacfc5a35b1aa5eb6d59c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=94=E5=90=9B?= Date: Fri, 4 Sep 2026 10:47:36 +0800 Subject: [PATCH] Fix subscription requests missing Accept header (#10095) --- v2rayN/ServiceLib/Handler/SubscriptionHandler.cs | 2 +- v2rayN/ServiceLib/Services/DownloadService.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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