summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2017-11-24 10:31:34 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-11-24 18:09:47 +0000
commit655cbb00a0a50588dcf527d2e7fdfeb172ba60ae (patch)
tree21318035ced49acebf1dbd75eae905cbc8ad9a4c
parent5a235da270a4ea65b7ef1edf31a761c41dbfcc88 (diff)
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>
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index da055de2da..5bc5f22fef 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -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;
}
}