Forward the readChannelFinished from the plain socket to the ssl socket
Task-number: QTBUG-62257 Change-Id: I12632b7ffd2012adc99b4784892cbb6f79e065f7 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
This commit is contained in:
parent
a72513cab7
commit
6e18293299
@ -2286,6 +2286,9 @@ void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode)
|
|||||||
q->connect(plainSocket, SIGNAL(channelBytesWritten(int, qint64)),
|
q->connect(plainSocket, SIGNAL(channelBytesWritten(int, qint64)),
|
||||||
q, SLOT(_q_channelBytesWrittenSlot(int, qint64)),
|
q, SLOT(_q_channelBytesWrittenSlot(int, qint64)),
|
||||||
Qt::DirectConnection);
|
Qt::DirectConnection);
|
||||||
|
q->connect(plainSocket, SIGNAL(readChannelFinished()),
|
||||||
|
q, SLOT(_q_readChannelFinishedSlot()),
|
||||||
|
Qt::DirectConnection);
|
||||||
#ifndef QT_NO_NETWORKPROXY
|
#ifndef QT_NO_NETWORKPROXY
|
||||||
q->connect(plainSocket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
|
q->connect(plainSocket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
|
||||||
q, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
|
q, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
|
||||||
@ -2504,6 +2507,15 @@ void QSslSocketPrivate::_q_channelBytesWrittenSlot(int channel, qint64 written)
|
|||||||
emit q->channelBytesWritten(channel, written);
|
emit q->channelBytesWritten(channel, written);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
void QSslSocketPrivate::_q_readChannelFinishedSlot()
|
||||||
|
{
|
||||||
|
Q_Q(QSslSocket);
|
||||||
|
emit q->readChannelFinished();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
|
@ -224,6 +224,7 @@ private:
|
|||||||
Q_PRIVATE_SLOT(d_func(), void _q_channelReadyReadSlot(int))
|
Q_PRIVATE_SLOT(d_func(), void _q_channelReadyReadSlot(int))
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_bytesWrittenSlot(qint64))
|
Q_PRIVATE_SLOT(d_func(), void _q_bytesWrittenSlot(qint64))
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_channelBytesWrittenSlot(int, qint64))
|
Q_PRIVATE_SLOT(d_func(), void _q_channelBytesWrittenSlot(int, qint64))
|
||||||
|
Q_PRIVATE_SLOT(d_func(), void _q_readChannelFinishedSlot())
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer())
|
Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer())
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer())
|
Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer())
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_resumeImplementation())
|
Q_PRIVATE_SLOT(d_func(), void _q_resumeImplementation())
|
||||||
|
@ -180,6 +180,7 @@ public:
|
|||||||
void _q_channelReadyReadSlot(int);
|
void _q_channelReadyReadSlot(int);
|
||||||
void _q_bytesWrittenSlot(qint64);
|
void _q_bytesWrittenSlot(qint64);
|
||||||
void _q_channelBytesWrittenSlot(int, qint64);
|
void _q_channelBytesWrittenSlot(int, qint64);
|
||||||
|
void _q_readChannelFinishedSlot();
|
||||||
void _q_flushWriteBuffer();
|
void _q_flushWriteBuffer();
|
||||||
void _q_flushReadBuffer();
|
void _q_flushReadBuffer();
|
||||||
void _q_resumeImplementation();
|
void _q_resumeImplementation();
|
||||||
|
@ -237,6 +237,7 @@ private slots:
|
|||||||
void ephemeralServerKey();
|
void ephemeralServerKey();
|
||||||
void allowedProtocolNegotiation();
|
void allowedProtocolNegotiation();
|
||||||
void pskServer();
|
void pskServer();
|
||||||
|
void forwardReadChannelFinished();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setEmptyDefaultConfiguration(); // this test should be last
|
void setEmptyDefaultConfiguration(); // this test should be last
|
||||||
@ -3771,6 +3772,28 @@ void tst_QSslSocket::pskServer()
|
|||||||
QCOMPARE(disconnectedSpy.count(), 1);
|
QCOMPARE(disconnectedSpy.count(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QSslSocket::forwardReadChannelFinished()
|
||||||
|
{
|
||||||
|
if (!QSslSocket::supportsSsl())
|
||||||
|
QSKIP("Needs SSL");
|
||||||
|
QFETCH_GLOBAL(bool, setProxy);
|
||||||
|
if (setProxy)
|
||||||
|
QSKIP("This test doesn't work via a proxy");
|
||||||
|
|
||||||
|
QSslSocket socket;
|
||||||
|
QSignalSpy readChannelFinishedSpy(&socket, &QAbstractSocket::readChannelFinished);
|
||||||
|
connect(&socket, &QSslSocket::encrypted, [&socket]() {
|
||||||
|
const auto data = QString("GET /ip HTTP/1.0\r\nHost: %1\r\n\r\nAccept: */*\r\n\r\n")
|
||||||
|
.arg(QtNetworkSettings::serverLocalName()).toUtf8();
|
||||||
|
socket.write(data);
|
||||||
|
});
|
||||||
|
connect(&socket, &QSslSocket::readChannelFinished,
|
||||||
|
&QTestEventLoop::instance(), &QTestEventLoop::exitLoop);
|
||||||
|
socket.connectToHostEncrypted(QtNetworkSettings::serverLocalName(), 443);
|
||||||
|
enterLoop(10);
|
||||||
|
QVERIFY(readChannelFinishedSpy.count());
|
||||||
|
}
|
||||||
|
|
||||||
#endif // QT_NO_OPENSSL
|
#endif // QT_NO_OPENSSL
|
||||||
|
|
||||||
#endif // QT_NO_SSL
|
#endif // QT_NO_SSL
|
||||||
|
Loading…
Reference in New Issue
Block a user