Add custom HTTP headers for subscription updates (#10118)

* Add custom HTTP headers for subscription updates

* Res

---------

Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
稔君
2026-09-09 14:24:05 +08:00
committed by GitHub
parent 143ada1358
commit b10c16a94a
17 changed files with 485 additions and 35 deletions
@@ -13,6 +13,8 @@ public class DownloadService
public string? AcceptHeader { get; init; }
public IReadOnlyDictionary<string, string>? RequestHeaders { get; init; }
private static readonly string _tag = "DownloadService";
/// <summary>
@@ -246,7 +248,7 @@ public class DownloadService
handler.SslOptions.RemoteCertificateValidationCallback = null;
}
using var client = new HttpClient(handler)
using var client = new HttpClient(HttpRequestHeadersHelper.CreateHandler(handler, RequestHeaders))
{
Timeout = Timeout.InfiniteTimeSpan
};
@@ -297,7 +299,7 @@ public class DownloadService
{
userAgent = Utils.GetVersion(false);
}
var result = await DownloaderHelper.Instance.DownloadStringAsync(webProxy, url, userAgent, timeout);
var result = await DownloaderHelper.Instance.DownloadStringAsync(webProxy, url, userAgent, timeout, RequestHeaders, AcceptHeader);
return result;
}
catch (Exception ex)