[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kio
From: Dawit Alemayehu <adawit () kde ! org>
Date: 2010-06-11 4:50:53
Message-ID: 20100611045053.E6F07AC8CF () svn ! kde ! org
[Download RAW message or body]
SVN commit 1136909 by adawit:
- Added code for mapping KIO SSL information into QSslConfiguration.
See http://reviewboard.kde.org/r/4239/
M +5 -2 DESIGN.metadata
M +36 -2 kio/accessmanager.cpp
M +8 -0 kio/accessmanager.h
M +6 -4 kio/accessmanagerreply_p.cpp
M +1 -0 kio/tcpslavebase.cpp
--- trunk/KDE/kdelibs/kio/DESIGN.metadata #1136908:1136909
@@ -8,8 +8,7 @@
Any meta data whose "key" starts with the keywords {internal~currenthost} and
"{internal~allhosts}" will be treated as internal metadata and will not be made
available to client applications. Instead all such meta-data will be stored and
-will appropriately be sent back to all ioslaves along with the other regular
-metadata values.
+sent back to the appropriate ioslaves along with the other regular metadata values.
Use "{internal~currenthost}" to make the internal metadata available to all
ioslaves of the same protocol and host as the ioslave that generated it. If
@@ -101,7 +100,11 @@
ssl_no_ui bool Flag to tell TCPSlave that no user interaction should take place. \
Instead of asking security questions the connection will silently fail. This is of \
particular use to favicon code. (default: false)
ssl_cipher string Set in TCPSlaveBase to tell the caller which cipher is currently \
being used. + This string is composed of the \
encryption, authentication, key-exchange and digest + \
methods separated by an LF (\n).
+ssl_cipher_name string Set in TCPSlaveBase to tell the caller the name of \
the cipher used. +
ssl_cipher_desc string Set in TCPSlaveBase to describe the details of the current \
cipher being used.
ssl_cipher_version string Set in TCPSlaveBase to describe the version of the cipher \
being used.
--- trunk/KDE/kdelibs/kio/kio/accessmanager.cpp #1136908:1136909
@@ -31,11 +31,14 @@
#include <ksharedconfig.h>
#include <QtCore/QUrl>
-#include <QtNetwork/QNetworkReply>
-#include <QtNetwork/QNetworkRequest>
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusReply>
+#include <QtNetwork/QNetworkReply>
+#include <QtNetwork/QNetworkRequest>
+#include <QtNetwork/QSslCipher>
+#include <QtNetwork/QSslCertificate>
+#include <QtNetwork/QSslConfiguration>
#define QL1S(x) QLatin1String(x)
@@ -251,6 +254,37 @@
using namespace KIO::Integration;
+static QSsl::SslProtocol qSslProtocolFromString(const QString& str)
+{
+ if (str.compare(QLatin1String("SSLv3"), Qt::CaseInsensitive) == 0)
+ return QSsl::SslV3;
+
+ if (str.compare(QLatin1String("SSLv2"), Qt::CaseInsensitive) == 0)
+ return QSsl::SslV2;
+
+ if (str.compare(QLatin1String("TLSv1"), Qt::CaseInsensitive) == 0)
+ return QSsl::TlsV1;
+
+ return QSsl::AnyProtocol;
+}
+
+bool KIO::Integration::sslConfigFromMetaData(const KIO::MetaData& metadata, \
QSslConfiguration& sslconfig) +{
+ bool success = false;
+
+ if (metadata.contains(QL1S("ssl_in_use"))) {
+ const QSsl::SslProtocol sslProto = \
qSslProtocolFromString(metadata.value("ssl_protocol_version")); + \
QList<QSslCipher> cipherList; + cipherList << \
QSslCipher(metadata.value("ssl_cipher_name"), sslProto); + \
sslconfig.setCaCertificates(QSslCertificate::fromData(metadata.value("ssl_peer_chain").toUtf8()));
+ sslconfig.setCiphers(cipherList);
+ sslconfig.setProtocol(sslProto);
+ success = sslconfig.isNull();
+ }
+
+ return success;
+}
+
CookieJar::CookieJar(QObject* parent)
:QNetworkCookieJar(parent), d(new CookieJar::CookieJarPrivate) {
reparseConfiguration();
--- trunk/KDE/kdelibs/kio/kio/accessmanager.h #1136908:1136909
@@ -173,6 +173,14 @@
typedef KIO::AccessManager AccessManager;
/**
+ * Maps KIO SSL meta data into the given QSslConfiguration object.
+ *
+ * @since 4.5
+ * @return true if @p metadata contains ssl information and the mapping succeeded.
+ */
+bool sslConfigFromMetaData(const KIO::MetaData& metadata, QSslConfiguration& \
sslconfig); +
+/**
* @short A KDE implementation of QNetworkCookieJar.
*
* Use this class in place of QNetworkCookieJar if you want to integrate with
--- trunk/KDE/kdelibs/kio/kio/accessmanagerreply_p.cpp #1136908:1136909
@@ -63,7 +63,6 @@
if (!request.sslConfiguration().isNull()) {
setSslConfiguration(request.sslConfiguration());
- kDebug( 7044 ) << "QSslConfiguration not supported (currently).";
}
if (!kioJob) { // a blocked request
@@ -122,9 +121,12 @@
if (!responseCode.isEmpty())
setAttribute(QNetworkRequest::HttpStatusCodeAttribute, \
responseCode.toInt());
- // Set the encrypted attribute...
- setAttribute(QNetworkRequest::ConnectionEncryptedAttribute,
- (QString::compare(job->queryMetaData("ssl_in_use"), \
QLatin1String("true"), Qt::CaseInsensitive) == 0)); + // Set the encryption \
attribute and values... + QSslConfiguration sslConfig;
+ const bool isEncrypted = \
KIO::Integration::sslConfigFromMetaData(job->metaData(), sslConfig); + \
setAttribute(QNetworkRequest::ConnectionEncryptedAttribute, isEncrypted); + if \
(isEncrypted) + setSslConfiguration(sslConfig);
// Set the raw header information...
const QString headers = job->queryMetaData("HTTP-Headers");
--- trunk/KDE/kdelibs/kio/kio/tcpslavebase.cpp #1136908:1136909
@@ -114,6 +114,7 @@
sslCipher += cipher.keyExchangeMethod() + '\n';
sslCipher += cipher.digestMethod();
q->setMetaData("ssl_cipher", sslCipher);
+ q->setMetaData("ssl_cipher_name", cipher.name());
q->setMetaData("ssl_cipher_used_bits", QString::number(cipher.usedBits()));
q->setMetaData("ssl_cipher_bits", QString::number(cipher.supportedBits()));
q->setMetaData("ssl_peer_ip", ip);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic