Dire perche' una richiesta fallisce, e annunciare HTTP/1.1 con ALPN
engine_session_fetch non riportava il motivo: restituiva NULL e il guscio mostrava "richiesta fallita", che non serve a nessuno. Ora c'e' un parametro d'errore e il guscio lo scrive nel log insieme all'indirizzo. TLS annuncia http/1.1 con ALPN: alcuni server e CDN rifiutano chi non negozia nulla, ed era una differenza silenziosa rispetto ai browser veri.
This commit is contained in:
1 parent
4d0e55bc16
commit
befb3f289f
6 files changed
+54
-11
No files matched your search
@@ -230,17 +230,24 @@ bool EngineView::serviFetch()
|
||||
engine_string_free(assoluto);
|
||||
|
||||
int stato = 0;
|
||||
char *messaggio_fetch = nullptr;
|
||||
char *corpo_risposta = engine_session_fetch(m_sessione.get(),
|
||||
url.constData(),
|
||||
metodo.toUtf8().constData(),
|
||||
corpo.toUtf8().constData(),
|
||||
&stato);
|
||||
&stato,
|
||||
&messaggio_fetch);
|
||||
const QByteArray dati(corpo_risposta ? corpo_risposta : "");
|
||||
if (corpo_risposta) {
|
||||
engine_string_free(corpo_risposta);
|
||||
}
|
||||
if (!corpo_risposta) {
|
||||
qWarning() << "mosaic: fetch fallita" << url;
|
||||
const QString motivo = messaggio_fetch ? QString::fromUtf8(messaggio_fetch)
|
||||
: QStringLiteral("motivo non riportato");
|
||||
qWarning() << "mosaic: fetch fallita" << url << "—" << motivo;
|
||||
}
|
||||
if (messaggio_fetch) {
|
||||
engine_string_free(messaggio_fetch);
|
||||
}
|
||||
if (engine_doc_deliver(m_doc, id, corpo_risposta ? stato : -1, dati.constData()) > 0) {
|
||||
cambiato = true;
|
||||
@@ -548,8 +555,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);
|
||||
char *testo = engine_session_fetch(sessione.get(), u.c_str(), "GET", "", &stato,
|
||||
&messaggio);
|
||||
if (testo) {
|
||||
html = testo;
|
||||
engine_string_free(testo);
|
||||
@@ -557,7 +564,11 @@ void EngineView::loadUrl(const QString &url)
|
||||
errore = messaggio;
|
||||
engine_string_free(messaggio);
|
||||
} else {
|
||||
errore = "richiesta fallita";
|
||||
errore = "richiesta fallita (motivo non riportato)";
|
||||
}
|
||||
if (!errore.empty()) {
|
||||
qWarning() << "mosaic: caricamento fallito" << u.c_str() << "—"
|
||||
<< QString::fromStdString(errore);
|
||||
}
|
||||
if (!vivo->load() || self.isNull()) {
|
||||
return; // il guscio non c'è più
|
||||
|
||||
Reference in new issue
Block a user