Client del sito contro il sito di prova (#36, S2)
HttpSiteRequester è l'unica classe che parla col sito: va solo a https://www.instagram.com/ o a un sito di prova di loopback, non segue i rinvii, una richiesta per volta col permesso del Governatore, solo le intestazioni del catalogo con l'user agent della sessione, e registra solo operazione, forma del percorso e stato. Cookie rinnovati e claim finiscono nella sessione (ISiteSession, per ora in memoria; la copia cifrata è S4). SiteAnswerSignals traduce le risposte nei segnali di §7.6: 429 rallenta; rinvii, 401/403, HTML o campi mancanti valgono come Verifica (H16). Il sito di prova risponde alle richieste dirette come dice richieste.prova.json e simula i casi d'arresto; una visita senza sessione viva apre una sessione nuova anche per il client. Nulla è ancora collegato al motore (S3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e10c25d12d
commit
ce9691fe1c
19 files changed
+3563
-51
No files matched your search
@@ -203,6 +203,16 @@ public sealed partial class RequestCatalogTests
|
||||
ownAgent["headers"] = new JsonObject { ["user-agent"] = "constant:Febe/1.0" };
|
||||
StringAssert.Contains(Refuse(Alone(ownAgent)), "user-agent");
|
||||
|
||||
// A configured operation without the browser's user agent would leave with none (rule 4).
|
||||
var noAgent = Rest("post2", "/dati/post/{code}");
|
||||
noAgent.Remove("headers");
|
||||
StringAssert.Contains(Refuse(Alone(noAgent)), "user-agent");
|
||||
var notConfigured = Rest("post2", "/dati/post/{code}");
|
||||
notConfigured.Remove("headers");
|
||||
notConfigured["configured"] = false;
|
||||
notConfigured["reason"] = "da campioni";
|
||||
Assert.IsNotNull(RequestCatalog.Parse(Alone(notConfigured), "richieste.prova.json"), "Not configured: it never leaves, the line can wait.");
|
||||
|
||||
var unknownValue = Rest("post2", "/dati/post/{password}");
|
||||
StringAssert.Contains(Refuse(Alone(unknownValue)), "valore del caso");
|
||||
|
||||
@@ -350,6 +360,7 @@ public sealed partial class RequestCatalogTests
|
||||
["path"] = path,
|
||||
["category"] = "post",
|
||||
["configured"] = true,
|
||||
["headers"] = new JsonObject { ["user-agent"] = "session:user_agent" },
|
||||
["rootFields"] = new JsonArray("contenuto"),
|
||||
["sample"] = "000005-post-serie",
|
||||
};
|
||||
@@ -362,7 +373,7 @@ public sealed partial class RequestCatalogTests
|
||||
["path"] = "/api/graphql",
|
||||
["category"] = "profilo",
|
||||
["configured"] = true,
|
||||
["headers"] = new JsonObject { ["x-fb-friendly-name"] = "operation" },
|
||||
["headers"] = new JsonObject { ["user-agent"] = "session:user_agent", ["x-fb-friendly-name"] = "operation" },
|
||||
["body"] = new JsonObject { ["variables"] = "variables", ["doc_id"] = "session:doc_id", ["fb_api_req_friendly_name"] = "operation" },
|
||||
["variables"] = new JsonObject { ["id"] = "{account_id}" },
|
||||
["rootFields"] = new JsonArray("data.user"),
|
||||
|
||||
Reference in new issue
Block a user