mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-19 11:45:00 +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)
|
private static DownloadService CreateDownloadHandler(string hashCode, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
var downloadHandle = new DownloadService();
|
var downloadHandle = new DownloadService { AcceptHeader = "*/*" };
|
||||||
downloadHandle.Error += (sender2, args) =>
|
downloadHandle.Error += (sender2, args) =>
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(false, $"{hashCode}{args.GetException().Message}");
|
updateFunc?.Invoke(false, $"{hashCode}{args.GetException().Message}");
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ public class DownloadService
|
|||||||
|
|
||||||
public event ErrorEventHandler? Error;
|
public event ErrorEventHandler? Error;
|
||||||
|
|
||||||
|
public string? AcceptHeader { get; init; }
|
||||||
|
|
||||||
private static readonly string _tag = "DownloadService";
|
private static readonly string _tag = "DownloadService";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -253,6 +255,10 @@ public class DownloadService
|
|||||||
userAgent = Utils.GetVersion(false);
|
userAgent = Utils.GetVersion(false);
|
||||||
}
|
}
|
||||||
client.DefaultRequestHeaders.UserAgent.TryParseAdd(userAgent);
|
client.DefaultRequestHeaders.UserAgent.TryParseAdd(userAgent);
|
||||||
|
if (AcceptHeader.IsNotEmpty())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Accept.ParseAdd(AcceptHeader);
|
||||||
|
}
|
||||||
|
|
||||||
Uri uri = new(url);
|
Uri uri = new(url);
|
||||||
//Authorization Header
|
//Authorization Header
|
||||||
|
|||||||
Reference in New Issue
Block a user