diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/network/ssl/qsslsocket.cpp | 35 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_p.h | 3 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index f89b9b3..7fc36c8 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -2246,6 +2246,41 @@ void QSslSocketPrivate::_q_flushReadBuffer() /*! \internal */ +qint64 QSslSocketPrivate::peek(char *data, qint64 maxSize) +{ + if (mode == QSslSocket::UnencryptedMode && !autoStartHandshake) { + if (plainSocket) + return plainSocket->peek(data, maxSize); + else + return -1; + } else { + QByteArray tmp; + tmp = readBuffer.peek(maxSize); + memcpy(data, tmp.data(), tmp.length()); + return tmp.length(); + } +} + +/*! + \internal +*/ +QByteArray QSslSocketPrivate::peek(qint64 maxSize) +{ + if (mode == QSslSocket::UnencryptedMode && !autoStartHandshake) { + if (plainSocket) + return plainSocket->peek(maxSize); + else + return QByteArray(); + } else { + QByteArray tmp; + tmp = readBuffer.peek(maxSize); + return tmp; + } +} + +/*! + \internal +*/ QList<QByteArray> QSslSocketPrivate::unixRootCertDirectories() { return QList<QByteArray>() << "/etc/ssl/certs/" // (K)ubuntu, OpenSUSE, Mandriva, MeeGo ... diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 606352b..58515c9 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -159,6 +159,9 @@ public: void _q_flushWriteBuffer(); void _q_flushReadBuffer(); + virtual qint64 peek(char *data, qint64 maxSize); + virtual QByteArray peek(qint64 maxSize); + // Platform specific functions virtual void startClientEncryption() = 0; virtual void startServerEncryption() = 0; |