HTTP/2, proxy, multipart e processo di rete separato (M2.6b)
HTTP/2 (src/http2.rs): preface, SETTINGS, HEADERS/CONTINUATION, DATA, WINDOW_UPDATE, PING, RST_STREAM, GOAWAY; HPACK con tabella statica, dinamica e Huffman. Le tabelle sono generate dalla RFC 7541 (src/hpack_tabelle.rs) e validate sui suoi esempi, non trascritte a mano. Ambito dichiarato: una richiesta per connessione, senza multiplexing ne' push. Proxy (src/net.rs): http_proxy/https_proxy/all_proxy/no_proxy, tunnel CONNECT per https, Proxy-Authorization con base64. Provato con un finto proxy locale: forma assoluta per http, CONNECT per https, rifiuto del tunnel riportato. multipart/form-data e text/plain oltre a urlencoded (src/invio.rs): il corpo viaggia col tipo dichiarato, e il test verifica che il confine annunciato nell'intestazione separi davvero le parti che il server riceve. Processo di rete separato (src/bin/mosaic-net.rs): IPC a lunghezza prefissata su stdin/stdout, corpo in base64; il servizio tiene cookie e cache. Il desktop lo usa con --rete-esterna. Sul telefono la rete resta nel processo: un'app sandboxata non avvia figli in modo affidabile. Due difetti trovati dai test e non dalla lettura: - intero() in HPACK mascherava con AND invece di comporre con OR: ogni lunghezza di stringa finiva a zero. Era il GOAWAY dei siti veri. - rustls stringe la mano pigramente: alpn_protocol() era vuoto e si finiva sempre in HTTP/1.1 senza dirlo. Ora l'handshake e' forzato e MOSAIC_DEBUG lo stampa.
This commit is contained in:
1 parent
befb3f289f
commit
cc449a548d
21 files changed
+2222
-33
No files matched your search
@@ -83,6 +83,10 @@ int engine_doc_pump(EngineDoc *doc, uint64_t now_ms);
|
||||
/* Prima scadenza dei timer in ms, oppure -1. */
|
||||
int64_t engine_doc_next_timer(EngineDoc *doc);
|
||||
|
||||
/* Invio del formulario in attesa (pulsante premuto senza preventDefault):
|
||||
* JSON {metodo, url, corpo, tipo}, oppure NULL. Lo esegue il guscio. */
|
||||
char *engine_doc_invio_json(EngineDoc *doc, const char *state_json);
|
||||
|
||||
/* Errori degli script e messaggi di console.log, una voce per riga. */
|
||||
char *engine_doc_errors(EngineDoc *doc);
|
||||
|
||||
@@ -96,8 +100,8 @@ void engine_session_free(EngineSession *sessione);
|
||||
* Restituisce il corpo da liberare con engine_string_free(), o NULL; *status
|
||||
* riceve il codice HTTP (0 se non c'è stata risposta). */
|
||||
char *engine_session_fetch(EngineSession *sessione, const char *url,
|
||||
const char *metodo, const char *corpo, int *status,
|
||||
char **error);
|
||||
const char *metodo, const char *corpo,
|
||||
const char *tipo, int *status, char **error);
|
||||
|
||||
/* Indirizzo assoluto di un riferimento rispetto al documento (NULL se non è rete). */
|
||||
char *engine_risolvi_url(const char *base, const char *riferito);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Name: harbour-mosaic
|
||||
Summary: Mosaic browser with an independent rendering engine
|
||||
Version: 0.8.9
|
||||
Version: 0.8.10
|
||||
Release: 1
|
||||
Group: Qt/Qt
|
||||
License: MIT
|
||||
@@ -21,6 +21,13 @@ engine written from scratch (no WebKit, Blink, Gecko or Servo code).
|
||||
Milestone M0: HTML parsing, CSS cascade, block layout and CPU raster.
|
||||
|
||||
%changelog
|
||||
* Thu Nov 12 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.8.10-1
|
||||
- Rete: HTTP/2 con HPACK (tabelle generate dalla RFC 7541), negoziato via ALPN
|
||||
- Proxy http_proxy/https_proxy/no_proxy con tunnel CONNECT
|
||||
- multipart/form-data e text/plain oltre a urlencoded: l'invio dei formulari
|
||||
porta il tipo di contenuto giusto
|
||||
- Il motivo di una richiesta fallita arriva al guscio e finisce nel log
|
||||
|
||||
* Thu Nov 12 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.8.9-1
|
||||
- Il motivo di una richiesta fallita non va piu' perso: engine_session_fetch ha
|
||||
un parametro d'errore, e il guscio lo scrive nel log insieme all'indirizzo
|
||||
|
||||
@@ -188,11 +188,70 @@ void EngineView::clicCss(qreal cssX, qreal cssY)
|
||||
}
|
||||
const int gestori = engine_doc_click(m_doc, float(cssX), float(cssY));
|
||||
qDebug() << "mosaic: click js" << cssX << cssY << "gestori" << gestori;
|
||||
|
||||
// pulsante di invio senza preventDefault: il formulario va mandato davvero
|
||||
if (eseguiInvio()) {
|
||||
return; // la risposta sostituisce la pagina e la ridisegna
|
||||
}
|
||||
if (gestori > 0) {
|
||||
rerender();
|
||||
}
|
||||
}
|
||||
|
||||
/// Esegue l'invio del formulario che il motore ha lasciato in attesa, se c'è.
|
||||
/// Restituisce vero se la pagina è stata sostituita dalla risposta.
|
||||
bool EngineView::eseguiInvio()
|
||||
{
|
||||
if (!m_doc || !m_sessione) {
|
||||
return false;
|
||||
}
|
||||
const QByteArray stato = stateJson().toUtf8();
|
||||
char *json = engine_doc_invio_json(m_doc, stato.constData());
|
||||
if (!json) {
|
||||
return false;
|
||||
}
|
||||
const QJsonObject richiesta = QJsonDocument::fromJson(QByteArray(json)).object();
|
||||
engine_string_free(json);
|
||||
if (richiesta.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const QString metodo = richiesta.value(QStringLiteral("metodo")).toString(QStringLiteral("GET"));
|
||||
const QString url = richiesta.value(QStringLiteral("url")).toString();
|
||||
const QString corpo = richiesta.value(QStringLiteral("corpo")).toString();
|
||||
const QString tipo = richiesta.value(QStringLiteral("tipo")).toString();
|
||||
if (url.isEmpty()) {
|
||||
setError(QStringLiteral("invio senza indirizzo"));
|
||||
return false;
|
||||
}
|
||||
qDebug() << "mosaic: invio" << metodo << url;
|
||||
|
||||
int statoHttp = 0;
|
||||
char *errore = nullptr;
|
||||
char *testo = engine_session_fetch(m_sessione.get(),
|
||||
url.toUtf8().constData(),
|
||||
metodo.toUtf8().constData(),
|
||||
corpo.toUtf8().constData(),
|
||||
tipo.toUtf8().constData(),
|
||||
&statoHttp,
|
||||
&errore);
|
||||
if (errore) {
|
||||
setError(QStringLiteral("invio fallito — %1").arg(QString::fromUtf8(errore)));
|
||||
engine_string_free(errore);
|
||||
}
|
||||
if (!testo) {
|
||||
return false;
|
||||
}
|
||||
m_html = QString::fromUtf8(testo);
|
||||
engine_string_free(testo);
|
||||
m_url = url;
|
||||
creaDocumento();
|
||||
rerender();
|
||||
emit htmlChanged();
|
||||
emit urlChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Fa avanzare i timer della pagina. Restituisce vero se qualcosa è cambiato.
|
||||
bool EngineView::serviFetch()
|
||||
{
|
||||
@@ -235,6 +294,7 @@ bool EngineView::serviFetch()
|
||||
url.constData(),
|
||||
metodo.toUtf8().constData(),
|
||||
corpo.toUtf8().constData(),
|
||||
"",
|
||||
&stato,
|
||||
&messaggio_fetch);
|
||||
const QByteArray dati(corpo_risposta ? corpo_risposta : "");
|
||||
@@ -555,8 +615,8 @@ void EngineView::loadUrl(const QString &url)
|
||||
int stato = 0;
|
||||
char *messaggio = nullptr;
|
||||
// con la sessione: i cookie ricevuti restano per le richieste successive
|
||||
char *testo = engine_session_fetch(sessione.get(), u.c_str(), "GET", "", &stato,
|
||||
&messaggio);
|
||||
char *testo = engine_session_fetch(sessione.get(), u.c_str(), "GET", "", "",
|
||||
&stato, &messaggio);
|
||||
if (testo) {
|
||||
html = testo;
|
||||
engine_string_free(testo);
|
||||
|
||||
@@ -131,6 +131,8 @@ private:
|
||||
void creaDocumento();
|
||||
/// esegue le fetch accodate dagli script (cookie inclusi)
|
||||
bool serviFetch();
|
||||
/// esegue l'invio del formulario lasciato in attesa dal motore
|
||||
bool eseguiInvio();
|
||||
/// documento con stato (DOM + JavaScript); nullo se non ancora creato
|
||||
EngineDoc *m_doc = nullptr;
|
||||
/// sessione di rete: cookie e cache condivisi da documento, risorse e fetch.
|
||||
|
||||
Reference in new issue
Block a user