Make https requests fail fast when configured without ssl support
Restored the Qt4 behaviour where attempting a https request using QNetworkAccessManager fails with ProtocolUnsupportedError instead of timing out or hanging. Covered by existing autotests. Task-number: QTBUG-17189 Change-Id: Iceb1ba6558c7d2b1af8ddf8d4ea9315a5b44d970 Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
parent
ae445b20fa
commit
49a7c2fe6e
@ -610,6 +610,9 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
|
|||||||
// here and there.
|
// here and there.
|
||||||
socket->setReadBufferSize(64*1024);
|
socket->setReadBufferSize(64*1024);
|
||||||
#else
|
#else
|
||||||
|
// Need to dequeue the request so that we can emit the error.
|
||||||
|
if (!reply)
|
||||||
|
connection->d_func()->dequeueRequest(socket);
|
||||||
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ProtocolUnknownError);
|
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ProtocolUnknownError);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
@ -974,7 +974,11 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
|
|||||||
|
|
||||||
#ifndef QT_NO_HTTP
|
#ifndef QT_NO_HTTP
|
||||||
// Since Qt 5 we use the new QNetworkReplyHttpImpl
|
// Since Qt 5 we use the new QNetworkReplyHttpImpl
|
||||||
if (scheme == QLatin1String("http") || scheme == QLatin1String("https") ) {
|
if (scheme == QLatin1String("http")
|
||||||
|
#ifndef QT_NO_SSL
|
||||||
|
|| scheme == QLatin1String("https")
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
QNetworkReplyHttpImpl *reply = new QNetworkReplyHttpImpl(this, request, op, outgoingData);
|
QNetworkReplyHttpImpl *reply = new QNetworkReplyHttpImpl(this, request, op, outgoingData);
|
||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
#ifndef QT_NO_BEARERMANAGEMENT
|
||||||
connect(this, SIGNAL(networkSessionConnected()),
|
connect(this, SIGNAL(networkSessionConnected()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user