using System; using static StellaOps.Localization.T; namespace StellaOps.Provcache; public sealed partial class HttpChunkFetcher { private void ValidateBaseAddress(Uri baseAddress) { if (!baseAddress.IsAbsoluteUri) { throw new InvalidOperationException(_t("common.provcache.fetch_url_absolute")); } if (!string.IsNullOrWhiteSpace(baseAddress.UserInfo)) { throw new InvalidOperationException(_t("common.provcache.fetch_url_no_userinfo")); } if (string.IsNullOrWhiteSpace(baseAddress.Host)) { throw new InvalidOperationException(_t("common.provcache.fetch_url_host_required")); } if (!_allowedSchemes.Contains(baseAddress.Scheme)) { throw new InvalidOperationException(_t("common.provcache.fetch_url_scheme_invalid", baseAddress.Scheme)); } if (!_allowAllHosts && !IsHostAllowed(baseAddress.Host, _allowedHosts)) { throw new InvalidOperationException(_t("common.provcache.fetch_url_host_invalid", baseAddress.Host)); } } }