QSslConfiguration: rename [get]session() to [get]sessionTicket()

to reflect the fact that this returns and sets the whole session
ticket, and not just the session ID.

Change-Id: I00fe2bc4197dbcd7a02b3ae4f2f84e3a2a7edad0
Reviewed-by: Richard J. Moore <rich@kde.org>
bb10
Peter Hartmann 2013-11-06 22:44:38 +01:00 committed by The Qt Project
parent f45e12f91a
commit becdfa6fab
6 changed files with 20 additions and 20 deletions

View File

@ -164,7 +164,7 @@ QT_BEGIN_NAMESPACE
\value SslOptionDisableSessionSharing Disables SSL session sharing via
the session ID handshake attribute.
\value SslOptionDisableSessionPersistence Disables storing the SSL session
in ASN.1 format as returned by QSslConfiguration::session(). Enabling
in ASN.1 format as returned by QSslConfiguration::sessionTicket(). Enabling
this feature adds memory overhead of approximately 1K per used session
ticket.

View File

@ -602,19 +602,19 @@ bool QSslConfiguration::testSslOption(QSsl::SslOption option) const
\since 5.2
If QSsl::SslOptionDisableSessionPersistence was turned off, this
function returns the session used in the SSL handshake in ASN.1
format, suitable to e.g. be persisted to disk. If no session was
function returns the session ticket used in the SSL handshake in ASN.1
format, suitable to e.g. be persisted to disk. If no session ticket was
used or QSsl::SslOptionDisableSessionPersistence was not turned off,
this function returns an empty QByteArray.
\b{Note:} When persisting the session to disk or similar, be
\b{Note:} When persisting the session ticket to disk or similar, be
careful not to expose the session to a potential attacker, as
knowledge of the session allows for eavesdropping on data
encrypted with the session parameters.
\sa setSession(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
\sa setSessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
*/
QByteArray QSslConfiguration::session() const
QByteArray QSslConfiguration::sessionTicket() const
{
return d->sslSession;
}
@ -622,16 +622,16 @@ QByteArray QSslConfiguration::session() const
/*!
\since 5.2
Sets the session to be used in an SSL handshake.
Sets the session ticket to be used in an SSL handshake.
QSsl::SslOptionDisableSessionPersistence must be turned off
for this to work, and \a session must be in ASN.1 format
as returned by session().
for this to work, and \a sessionTicket must be in ASN.1 format
as returned by sessionTicket().
\sa session(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
\sa sessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
*/
void QSslConfiguration::setSession(const QByteArray &session)
void QSslConfiguration::setSessionTicket(const QByteArray &sessionTicket)
{
d->sslSession = session;
d->sslSession = sessionTicket;
}
/*!
@ -645,7 +645,7 @@ void QSslConfiguration::setSession(const QByteArray &session)
QSsl::SslOptionDisableSessionPersistence was not turned off,
this function returns -1.
\sa session(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
\sa sessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
*/
int QSslConfiguration::sessionTicketLifeTimeHint() const
{

View File

@ -124,8 +124,8 @@ public:
void setSslOption(QSsl::SslOption option, bool on);
bool testSslOption(QSsl::SslOption option) const;
QByteArray session() const;
void setSession(const QByteArray &session);
QByteArray sessionTicket() const;
void setSessionTicket(const QByteArray &sessionTicket);
int sessionTicketLifeTimeHint() const;
static QSslConfiguration defaultConfiguration();

View File

@ -260,8 +260,8 @@ init_context:
q_SSL_CTX_set_verify_depth(sslContext->ctx, sslContext->sslConfiguration.peerVerifyDepth());
// set persisted session if the user set it
if (!configuration.session().isEmpty())
sslContext->setSessionASN1(configuration.session());
if (!configuration.sessionTicket().isEmpty())
sslContext->setSessionASN1(configuration.sessionTicket());
return sslContext;
}

View File

@ -903,7 +903,7 @@ void QSslSocket::setSslConfiguration(const QSslConfiguration &configuration)
d->configuration.peerVerifyMode = configuration.peerVerifyMode();
d->configuration.protocol = configuration.protocol();
d->configuration.sslOptions = configuration.d->sslOptions;
d->configuration.sslSession = configuration.session();
d->configuration.sslSession = configuration.sessionTicket();
d->configuration.sslSessionTicketLifeTimeHint = configuration.sessionTicketLifeTimeHint();
// if the CA certificates were set explicitly (either via

View File

@ -6042,7 +6042,7 @@ void tst_QNetworkReply::sslSessionSharingFromPersistentSession()
QTestEventLoop::instance().enterLoop(20);
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(warmupReply->error(), QNetworkReply::NoError);
QByteArray sslSession = warmupReply->sslConfiguration().session();
QByteArray sslSession = warmupReply->sslConfiguration().sessionTicket();
QCOMPARE(!sslSession.isEmpty(), sessionPersistenceEnabled);
// test server sends a life time hint of 0 (old server) or 300 (new server),
@ -6060,7 +6060,7 @@ void tst_QNetworkReply::sslSessionSharingFromPersistentSession()
QNetworkRequest request(warmupRequest);
if (sessionPersistenceEnabled) {
QSslConfiguration configuration = request.sslConfiguration();
configuration.setSession(sslSession);
configuration.setSessionTicket(sslSession);
request.setSslConfiguration(configuration);
}
QNetworkAccessManager newManager;