Raccolta: 429 del CDN come rallentamento, attese crescenti e recupero dei falliti, storico e seguiti senza pagina di ripresa, lacuna sotto la prima pagina, eliminazioni durante lo scaricamento (regole-3, cdn-429, dl-1, post-loop, walk-1, check-1, scroll-1, reader-1, h9-1, ring-1, library-2, dedup-1, tmp-1, budget-1, regole-4, kind-1, vocab-1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
28 files changed
+2619
-200
No files matched your search
@@ -48,6 +48,35 @@ public sealed class SignalDetector : IResponseObserver, IResponseConsumer, IStop
|
||||
public Signal? ObserveResponse(ResponseDescriptor response)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(response);
|
||||
return MatchResponse(response, statusOnly: false) is { } rule ? Raise(rule.Level, rule.Code, response.Url) : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The HTTP status of a file the download queue asked the CDN for (spec §6.5). The browser serves
|
||||
/// <c>Network.loadNetworkResource</c> outside the page, so the page's network events never show these responses:
|
||||
/// the queue reports them here, and the status rules for the CDN apply (e.g. 429, «vale per sito e CDN»).
|
||||
/// Returns the level of the matching rule — also when the same signal was already reported within
|
||||
/// <see cref="DedupeWindow"/>, so the caller stops every time — or null when no rule matches.
|
||||
/// </summary>
|
||||
/// <remarks>The incident keeps only scheme and host: the path of a CDN address identifies a file (spec §13.2).</remarks>
|
||||
public SignalLevel? ObserveDownload(Uri address, int status)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(address);
|
||||
var sanitized = UrlSanitizer.Sanitize(address.AbsoluteUri);
|
||||
var origin = $"{sanitized.Scheme}://{sanitized.Host}/";
|
||||
var response = new ResponseDescriptor("download", HostKind.Cdn, origin, sanitized.Host, "/", status, string.Empty, "Other", false, _clock.Now);
|
||||
if (MatchResponse(response, statusOnly: true) is not { } rule)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Raise(rule.Level, rule.Code, origin);
|
||||
return rule.Level;
|
||||
}
|
||||
|
||||
/// <summary>The first status or path rule for <paramref name="response"/>; path rules describe pages, not files.</summary>
|
||||
private SignalRule? MatchResponse(ResponseDescriptor response, bool statusOnly)
|
||||
{
|
||||
var scope = response.IsMainFrameDocument ? SignalScope.Document : SignalScope.Subresource;
|
||||
foreach (var rule in _rules.Rules)
|
||||
{
|
||||
@@ -57,9 +86,9 @@ public sealed class SignalDetector : IResponseObserver, IResponseConsumer, IStop
|
||||
}
|
||||
|
||||
if ((rule.Statuses.Count > 0 && rule.Statuses.Contains(response.Status))
|
||||
|| (rule.Path is not null && SafeIsMatch(rule.Path, response.Path)))
|
||||
|| (!statusOnly && rule.Path is not null && SafeIsMatch(rule.Path, response.Path)))
|
||||
{
|
||||
return Raise(rule.Level, rule.Code, response.Url);
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user