mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-13 18:02:07 +03:00
Fix subscription requests missing Accept header (#10095)
This commit is contained in:
@@ -82,7 +82,7 @@ public static class SubscriptionHandler
|
||||
|
||||
private static DownloadService CreateDownloadHandler(string hashCode, Func<bool, string, Task> updateFunc)
|
||||
{
|
||||
var downloadHandle = new DownloadService();
|
||||
var downloadHandle = new DownloadService { AcceptHeader = "*/*" };
|
||||
downloadHandle.Error += (sender2, args) =>
|
||||
{
|
||||
updateFunc?.Invoke(false, $"{hashCode}{args.GetException().Message}");
|
||||
|
||||
@@ -11,6 +11,8 @@ public class DownloadService
|
||||
|
||||
public event ErrorEventHandler? Error;
|
||||
|
||||
public string? AcceptHeader { get; init; }
|
||||
|
||||
private static readonly string _tag = "DownloadService";
|
||||
|
||||
/// <summary>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user