search and ai stabilization work, localization stablized.
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using static StellaOps.Localization.T;
|
||||
|
||||
namespace StellaOps.Provcache;
|
||||
|
||||
@@ -22,7 +23,7 @@ public sealed partial class HttpChunkFetcher
|
||||
var timeout = _options.Timeout;
|
||||
if (timeout <= TimeSpan.Zero || timeout == Timeout.InfiniteTimeSpan)
|
||||
{
|
||||
throw new InvalidOperationException("Lazy fetch HTTP timeout must be a positive, non-infinite duration.");
|
||||
throw new InvalidOperationException(_t("common.provcache.http_timeout_invalid"));
|
||||
}
|
||||
|
||||
if (_httpClient.Timeout == Timeout.InfiniteTimeSpan || _httpClient.Timeout > timeout)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using static StellaOps.Localization.T;
|
||||
|
||||
namespace StellaOps.Provcache;
|
||||
|
||||
@@ -8,27 +9,27 @@ public sealed partial class HttpChunkFetcher
|
||||
{
|
||||
if (!baseAddress.IsAbsoluteUri)
|
||||
{
|
||||
throw new InvalidOperationException("Lazy fetch base URL must be absolute.");
|
||||
throw new InvalidOperationException(_t("common.provcache.fetch_url_absolute"));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(baseAddress.UserInfo))
|
||||
{
|
||||
throw new InvalidOperationException("Lazy fetch base URL must not include user info.");
|
||||
throw new InvalidOperationException(_t("common.provcache.fetch_url_no_userinfo"));
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(baseAddress.Host))
|
||||
{
|
||||
throw new InvalidOperationException("Lazy fetch base URL must include a host.");
|
||||
throw new InvalidOperationException(_t("common.provcache.fetch_url_host_required"));
|
||||
}
|
||||
|
||||
if (!_allowedSchemes.Contains(baseAddress.Scheme))
|
||||
{
|
||||
throw new InvalidOperationException($"Lazy fetch base URL scheme '{baseAddress.Scheme}' is not allowed.");
|
||||
throw new InvalidOperationException(_t("common.provcache.fetch_url_scheme_invalid", baseAddress.Scheme));
|
||||
}
|
||||
|
||||
if (!_allowAllHosts && !IsHostAllowed(baseAddress.Host, _allowedHosts))
|
||||
{
|
||||
throw new InvalidOperationException($"Lazy fetch base URL host '{baseAddress.Host}' is not allowlisted.");
|
||||
throw new InvalidOperationException(_t("common.provcache.fetch_url_host_invalid", baseAddress.Host));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using static StellaOps.Localization.T;
|
||||
|
||||
namespace StellaOps.Provcache;
|
||||
|
||||
@@ -71,7 +72,7 @@ public sealed partial class HttpChunkFetcher : ILazyEvidenceFetcher, IDisposable
|
||||
};
|
||||
|
||||
var baseAddress = _httpClient.BaseAddress
|
||||
?? throw new InvalidOperationException("HttpChunkFetcher requires a BaseAddress on the HTTP client.");
|
||||
?? throw new InvalidOperationException(_t("common.provcache.http_base_address_required"));
|
||||
|
||||
_allowedSchemes = NormalizeSchemes(_options.AllowedSchemes);
|
||||
_allowedHosts = NormalizeHosts(_options.AllowedHosts, baseAddress.Host, out _allowAllHosts);
|
||||
|
||||
Reference in New Issue
Block a user