Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

QSslConfiguration: SSLv3 should be the default value

  • Loading branch information...
commit f3d920908a6f1f0728b9fab10d83e5a67b430974 1 parent b834f2a
@Vitallium Vitallium authored committed
Showing with 12 additions and 7 deletions.
  1. +4 −3 src/config.cpp
  2. +8 −4 src/networkaccessmanager.cpp
View
7 src/config.cpp
@@ -62,7 +62,7 @@ static const struct QCommandLineConfigEntry flags[] =
{ QCommandLine::Option, '\0', "proxy-type", "Specifies the proxy type, 'http' (default), 'none' (disable completely), or 'socks5'", QCommandLine::Optional },
{ QCommandLine::Option, '\0', "script-encoding", "Sets the encoding used for the starting script, default is 'utf8'", QCommandLine::Optional },
{ QCommandLine::Option, '\0', "web-security", "Enables web security, 'yes' (default) or 'no'", QCommandLine::Optional },
- { QCommandLine::Option, '\0', "ssl-protocol", "Sets the SSL protocol (supported protocols: 'SSLv3', 'SSLv2', 'TLSv1', 'TlsV1SslV3' (default))", QCommandLine::Optional },
+ { QCommandLine::Option, '\0', "ssl-protocol", "Sets the SSL protocol (supported protocols: 'SSLv3' (default), 'SSLv2', 'TLSv1', 'any')", QCommandLine::Optional },
{ QCommandLine::Param, '\0', "script", "Script", QCommandLine::Flags(QCommandLine::Optional|QCommandLine::ParameterFence)},
{ QCommandLine::Param, '\0', "argument", "Script argument", QCommandLine::OptionalMultiple },
{ QCommandLine::Switch, 'h', "help", "Shows this message and quits", QCommandLine::Optional },
@@ -454,6 +454,7 @@ void Config::resetToDefaults()
m_javascriptCanCloseWindows = true;
m_helpFlag = false;
m_printDebugMessages = false;
+ m_sslProtocol = "sslv3";
}
void Config::setProxyAuthPass(const QString &value)
@@ -595,7 +596,7 @@ void Config::handleOption(const QString &option, const QVariant &value)
setWebSecurityEnabled(boolValue);
}
if (option == "ssl-protocol") {
- setSslProtocol(value.toString().toLower());
+ setSslProtocol(value.toString());
}
}
@@ -621,5 +622,5 @@ QString Config::sslProtocol() const
void Config::setSslProtocol(const QString& sslProtocolName)
{
- m_sslProtocol = sslProtocolName;
+ m_sslProtocol = sslProtocolName.toLower();
}
View
12 src/networkaccessmanager.cpp
@@ -89,12 +89,16 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent, const Config *config
if (QSslSocket::supportsSsl()) {
m_sslConfiguration = QSslConfiguration::defaultConfiguration();
- if (config->sslProtocol() == "sslv3") {
- m_sslConfiguration.setProtocol(QSsl::SslV3);
- } else if (config->sslProtocol() == "sslv2") {
+
+ // set the SSL protocol to SSLv3 by the default
+ m_sslConfiguration.setProtocol(QSsl::SslV3);
+
+ if (config->sslProtocol() == "sslv2") {
m_sslConfiguration.setProtocol(QSsl::SslV2);
} else if (config->sslProtocol() == "tlsv1") {
m_sslConfiguration.setProtocol(QSsl::TlsV1);
+ } else if (config->sslProtocol() == "any") {
+ m_sslConfiguration.setProtocol(QSsl::AnyProtocol);
}
}
@@ -286,7 +290,7 @@ void NetworkAccessManager::handleSslErrors(const QList<QSslError> &errors)
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
foreach (QSslError e, errors) {
- qDebug()<<"Network - SSL Error:" << e;
+ qDebug() << "Network - SSL Error:" << e;
}
if (m_ignoreSslErrors)
Please sign in to comment.
Something went wrong with that request. Please try again.