Strato browser (M0/M2): client CDP con elenco dei comandi ammessi, ChromiumProcessHost e Xvfb sorvegliati, gesti umani, mappa dei bersagli, cattura delle risposte, segnali di arresto, scaricamento dal browser, vista remota, distribuzioni del ritmo; prove unitarie e d'insieme con Chromium su Xvfb; esito locale di S5 e S6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-13 15:51:02 +00:00
1 parent c803bd98b5
commit 925141bb37
44 files changed
+8396

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
namespace Febe.Core.Collection;
/// <summary>How a file download ended.</summary>
public enum FetchOutcome
{
/// <summary>All bytes were written to the destination.</summary>
Completed,
/// <summary>The server answered with an error status (e.g. an expired signed address, spec §6.5 point 5).</summary>
HttpError,
/// <summary>The request failed before a response (network error, refused by the browser).</summary>
NetworkError,
/// <summary>The file exceeded the maximum size allowed by the caller; the destination holds a partial copy.</summary>
TooLarge,
/// <summary>The address is not on an allowed host (only CDN addresses may be downloaded).</summary>
HostNotAllowed,
}
/// <summary>Result of a download. Never contains the address: it carries signatures (spec §13.2).</summary>
/// <param name="Outcome">How it ended.</param>
/// <param name="Bytes">Bytes written to the destination.</param>
/// <param name="HttpStatus">HTTP status code, when a response arrived.</param>
/// <param name="Error">Short error description without the address, when it failed.</param>
public sealed record FetchResult(FetchOutcome Outcome, long Bytes, int? HttpStatus, string? Error)
{
public bool Succeeded => Outcome == FetchOutcome.Completed;
}
/// <summary>Options of a single download.</summary>
/// <param name="MaxBytes">Abort with <see cref="FetchOutcome.TooLarge"/> past this size; null for no limit.</param>
/// <param name="Progress">Receives the number of bytes written so far.</param>
public sealed record FetchOptions(long? MaxBytes = null, IProgress<long>? Progress = null);
/// <summary>
/// Downloads one file indicated by the page into a stream (spec §6.5). The preferred implementation goes through
/// the browser (<c>Network.loadNetworkResource</c> + <c>IO.read</c>); a fallback through <c>HttpClient</c> to CDN hosts
/// only may be added if M0 shows the first one does not work with the real CDN (H7).
/// </summary>
/// <remarks>
/// The caller owns the destination: it writes to a temporary name, hashes and renames (spec §6.5 point 4).
/// Implementations never log the address. Cancellation throws <see cref="OperationCanceledException"/>.
/// </remarks>
public interface IFileFetcher
{
Task<FetchResult> FetchAsync(Uri address, Stream destination, FetchOptions? options, CancellationToken ct);
}