From 054e85bfdae2af37f0c2ee17d131e0b3cb2d2f25 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 30 Apr 2013 14:48:22 +0200 Subject: [BB10-internal] QSslConfiguration: add API to persist and resume SSL sessions Session tickets can be cached on the client side for hours (e.g. graph.facebook.com: ~ 24 hours, api.twitter.com: 4 hours), because the server does not need to maintain state. We need public API for it so an application can cache the session (e.g. to disk) and resume a session already with the 1st handshake, saving one network round trip. Task-number: QTBUG-20668 (backport of commit 3be197881f100d1c3c8f3ce00501d7a32eb51119) Change-Id: I4c7f3a749edf0012b52deeb495706e550d24c42d Signed-off-by: Peter Hartmann --- src/network/access/qhttpnetworkrequest.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/network/access/qhttpnetworkrequest.cpp') diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index 3fc6229e29..d437f6363a 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -50,6 +50,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Oper QHttpNetworkRequest::Priority pri, const QUrl &newUrl) : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0), autoDecompress(false), pipeliningAllowed(false), withCredentials(true) + , m_cacheSslSession(false) { } @@ -64,6 +65,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest customVerb = other.customVerb; withCredentials = other.withCredentials; ssl = other.ssl; + m_cacheSslSession = other.m_cacheSslSession; } QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate() @@ -75,7 +77,8 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (ssl == other.ssl) - && (uploadByteDevice == other.uploadByteDevice); + && (uploadByteDevice == other.uploadByteDevice) + && (m_cacheSslSession == other.m_cacheSslSession); } QByteArray QHttpNetworkRequestPrivate::methodName() const @@ -311,6 +314,16 @@ QNonContiguousByteDevice* QHttpNetworkRequest::uploadByteDevice() const return d->uploadByteDevice; } +bool QHttpNetworkRequest::cacheSslSession() +{ + return d->m_cacheSslSession; +} + +void QHttpNetworkRequest::setCacheSslSession(bool cacheSession) +{ + d->m_cacheSslSession = cacheSession; +} + int QHttpNetworkRequest::majorVersion() const { return 1; -- cgit v1.2.1