Handle HostNotFoundError correctly for HTTP/2
When processing host lookup error if-statement only checks the connection type SPDY, which is not right - it could also be HTTP/2. As a bonus: QT_NO_SSL conditional inclusion is not needed - HTTP2 can be 'clear text' and SPDY enumerator is defined even in no-tls build (and is just a noop here). Also, improve our somewhat cryptic message in 'Should not happen' else branch - 'cannot dequeu' says nothing about HostNotFoundError. Task-number: QTBUG-64721 Change-Id: Ib0346b8717c2dbddaffab690298f3cae01e338ea Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
5a235da270
commit
655cbb00a0
|
|
@ -1204,20 +1204,20 @@ void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(const QHostInfo &info)
|
|||
if (dequeueRequest(channels[0].socket)) {
|
||||
emitReplyError(channels[0].socket, channels[0].reply, QNetworkReply::HostNotFoundError);
|
||||
networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
|
||||
}
|
||||
#ifndef QT_NO_SSL
|
||||
else if (connectionType == QHttpNetworkConnection::ConnectionTypeSPDY) {
|
||||
} else if (connectionType == QHttpNetworkConnection::ConnectionTypeSPDY
|
||||
|| connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2) {
|
||||
for (const HttpMessagePair &spdyPair : qAsConst(channels[0].spdyRequestsToSend)) {
|
||||
// emit error for all replies
|
||||
QHttpNetworkReply *currentReply = spdyPair.second;
|
||||
Q_ASSERT(currentReply);
|
||||
emitReplyError(channels[0].socket, currentReply, QNetworkReply::HostNotFoundError);
|
||||
}
|
||||
}
|
||||
#endif // QT_NO_SSL
|
||||
else {
|
||||
// Should not happen
|
||||
qWarning("QHttpNetworkConnectionPrivate::_q_hostLookupFinished could not de-queue request");
|
||||
} else {
|
||||
// Should not happen: we start a host lookup before sending a request,
|
||||
// so it's natural to have requests either in SPDY/HTTP/2 queue,
|
||||
// or in low/high priority queues.
|
||||
qWarning("QHttpNetworkConnectionPrivate::_q_hostLookupFinished"
|
||||
" could not de-queue request, failed to report HostNotFoundError");
|
||||
networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue