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:
44 files changed
+8396
No files matched your search
@@ -0,0 +1,72 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Febe.Core.Collection;
|
||||
|
||||
/// <summary>Which kind of host served a response (spec §14.5: only the site/CDN distinction is kept).</summary>
|
||||
public enum HostKind
|
||||
{
|
||||
/// <summary>The site itself (Instagram pages and data, or the local test site).</summary>
|
||||
Site,
|
||||
|
||||
/// <summary>The content delivery network that serves photos and videos.</summary>
|
||||
Cdn,
|
||||
|
||||
/// <summary>Anything else the page happens to contact.</summary>
|
||||
Other,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sanitized description of a response seen by the page: never the query string, never headers, never the body.
|
||||
/// </summary>
|
||||
/// <param name="RequestId">Browser request identifier (opaque, only meaningful inside one browser session).</param>
|
||||
/// <param name="HostKind">Site, CDN or other.</param>
|
||||
/// <param name="Url">Scheme, host and path, without query string and fragment (see <see cref="UrlSanitizer"/>).
|
||||
/// For CDN responses it must not be logged: it identifies files (spec §13.2).</param>
|
||||
/// <param name="Host">Host name, with the port when it is not the default one.</param>
|
||||
/// <param name="Path">Path without query string and fragment.</param>
|
||||
/// <param name="Status">HTTP status code.</param>
|
||||
/// <param name="MimeType">MIME type declared by the response, lower case, without parameters.</param>
|
||||
/// <param name="ResourceType">Browser resource type (Document, XHR, Fetch, Image, ...), when known.</param>
|
||||
/// <param name="IsMainFrameDocument">True for the document of the main frame (a page load).</param>
|
||||
/// <param name="At">When the response was seen.</param>
|
||||
public sealed record ResponseDescriptor(
|
||||
string RequestId,
|
||||
HostKind HostKind,
|
||||
string Url,
|
||||
string Host,
|
||||
string Path,
|
||||
int Status,
|
||||
string MimeType,
|
||||
string? ResourceType,
|
||||
bool IsMainFrameDocument,
|
||||
DateTimeOffset At);
|
||||
|
||||
/// <summary>A main-frame navigation: a new document, or a route change inside a single-page site.</summary>
|
||||
/// <param name="HostKind">Site, CDN or other.</param>
|
||||
/// <param name="Url">Address without query string and fragment.</param>
|
||||
/// <param name="Host">Host name (with port when not default); empty for about:blank and similar.</param>
|
||||
/// <param name="Path">Path without query string and fragment.</param>
|
||||
/// <param name="At">When the navigation was seen.</param>
|
||||
/// <param name="SameDocument">True for a route change without a new document (history.pushState).</param>
|
||||
public sealed record NavigationDescriptor(HostKind HostKind, string Url, string Host, string Path, DateTimeOffset At, bool SameDocument = false);
|
||||
|
||||
/// <summary>
|
||||
/// Receives the JSON bodies captured by the response tap (spec §6.2): readers and signal detection.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <see cref="JsonDocument"/> is owned by the caller and disposed right after the call returns:
|
||||
/// consumers must not keep references to it or to its elements. Bodies live only in memory and are never logged.
|
||||
/// </remarks>
|
||||
public interface IResponseConsumer
|
||||
{
|
||||
ValueTask ConsumeAsync(ResponseDescriptor response, JsonDocument body, CancellationToken ct);
|
||||
}
|
||||
|
||||
/// <summary>Receives metadata of every response and every main-frame navigation (no bodies).</summary>
|
||||
/// <remarks>Called on the browser event thread: implementations must be quick and must not block.</remarks>
|
||||
public interface IResponseObserver
|
||||
{
|
||||
void OnResponse(ResponseDescriptor response);
|
||||
|
||||
void OnNavigation(NavigationDescriptor navigation);
|
||||
}
|
||||
Reference in new issue
Block a user