Skip to content

Commit 2a44253

Browse files
Don't ignore SSL errors
1 parent 49f57b1 commit 2a44253

File tree

7 files changed

+54
-6
lines changed

7 files changed

+54
-6
lines changed

src/base/net/downloadmanager.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,20 @@ Net::DownloadManager::DownloadManager(QObject *parent)
148148
QStringList errorList;
149149
for (const QSslError &error : errors)
150150
errorList += error.errorString();
151-
LogMsg(tr("Ignoring SSL error, URL: \"%1\", errors: \"%2\"").arg(reply->url().toString(), errorList.join(u". ")), Log::WARNING);
152151

153-
// Ignore all SSL errors
154-
reply->ignoreSslErrors();
152+
QString errorMsg;
153+
if (!Preferences::instance()->isIgnoreSSLErrors())
154+
{
155+
errorMsg = tr("SSL error, URL: \"%1\", errors: \"%2\"");
156+
}
157+
else
158+
{
159+
errorMsg = tr("Ignoring SSL error, URL: \"%1\", errors: \"%2\"");
160+
// Ignore all SSL errors
161+
reply->ignoreSslErrors();
162+
}
163+
164+
LogMsg(errorMsg.arg(reply->url().toString(), errorList.join(u". ")), Log::WARNING);
155165
});
156166

157167
connect(ProxyConfigurationManager::instance(), &ProxyConfigurationManager::proxyConfigurationChanged

src/base/preferences.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,19 @@ void Preferences::setMarkOfTheWebEnabled(const bool enabled)
13301330
setValue(u"Preferences/Advanced/markOfTheWeb"_s, enabled);
13311331
}
13321332

1333+
bool Preferences::isIgnoreSSLErrors() const
1334+
{
1335+
return value(u"Preferences/Advanced/IgnoreSSLErrors"_s, false);
1336+
}
1337+
1338+
void Preferences::setIgnoreSSLErrors(const bool enabled)
1339+
{
1340+
if (enabled == isIgnoreSSLErrors())
1341+
return;
1342+
1343+
setValue(u"Preferences/Advanced/IgnoreSSLErrors"_s, enabled);
1344+
}
1345+
13331346
Path Preferences::getPythonExecutablePath() const
13341347
{
13351348
return value(u"Preferences/Search/pythonExecutablePath"_s, Path());

src/base/preferences.h

+2
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ class Preferences final : public QObject
293293
void setTrackerPortForwardingEnabled(bool enabled);
294294
bool isMarkOfTheWebEnabled() const;
295295
void setMarkOfTheWebEnabled(bool enabled);
296+
bool isIgnoreSSLErrors() const;
297+
void setIgnoreSSLErrors(bool enabled);
296298
Path getPythonExecutablePath() const;
297299
void setPythonExecutablePath(const Path &path);
298300
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)

src/gui/advancedsettings.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ namespace
105105
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
106106
ENABLE_MARK_OF_THE_WEB,
107107
#endif // Q_OS_MACOS || Q_OS_WIN
108+
IGNORE_SSL_ERRORS,
108109
PYTHON_EXECUTABLE_PATH,
109110
START_SESSION_PAUSED,
110111
SESSION_SHUTDOWN_TIMEOUT,
@@ -332,6 +333,8 @@ void AdvancedSettings::saveAdvancedSettings() const
332333
// Mark-of-the-Web
333334
pref->setMarkOfTheWebEnabled(m_checkBoxMarkOfTheWeb.isChecked());
334335
#endif // Q_OS_MACOS || Q_OS_WIN
336+
// Ignore SSL errors
337+
pref->setIgnoreSSLErrors(m_checkBoxIgnoreSSLErrors.isChecked());
335338
// Python executable path
336339
pref->setPythonExecutablePath(Path(m_pythonExecutablePath.text().trimmed()));
337340
// Start session paused
@@ -853,6 +856,10 @@ void AdvancedSettings::loadAdvancedSettings()
853856
m_checkBoxMarkOfTheWeb.setChecked(pref->isMarkOfTheWebEnabled());
854857
addRow(ENABLE_MARK_OF_THE_WEB, motwLabel, &m_checkBoxMarkOfTheWeb);
855858
#endif // Q_OS_MACOS || Q_OS_WIN
859+
// Ignore SSL errors
860+
m_checkBoxIgnoreSSLErrors.setChecked(pref->isIgnoreSSLErrors());
861+
m_checkBoxIgnoreSSLErrors.setToolTip(tr("Affects certificate validation and non-torrent protocol activities (e.g. RSS feeds, program updates, torrent files, geoip db, etc)"));
862+
addRow(IGNORE_SSL_ERRORS, tr("Ignore SSL errors"), &m_checkBoxIgnoreSSLErrors);
856863
// Python executable path
857864
m_pythonExecutablePath.setPlaceholderText(tr("(Auto detect if empty)"));
858865
m_pythonExecutablePath.setText(pref->getPythonExecutablePath().toString());

src/gui/advancedsettings.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ private slots:
7777
m_spinBoxSavePathHistoryLength, m_spinBoxPeerTurnover, m_spinBoxPeerTurnoverCutoff, m_spinBoxPeerTurnoverInterval, m_spinBoxRequestQueueSize;
7878
QCheckBox m_checkBoxOsCache, m_checkBoxRecheckCompleted, m_checkBoxResolveCountries, m_checkBoxResolveHosts,
7979
m_checkBoxProgramNotifications, m_checkBoxTorrentAddedNotifications, m_checkBoxReannounceWhenAddressChanged, m_checkBoxTrackerFavicon, m_checkBoxTrackerStatus,
80-
m_checkBoxTrackerPortForwarding, m_checkBoxConfirmTorrentRecheck, m_checkBoxConfirmRemoveAllTags, m_checkBoxAnnounceAllTrackers, m_checkBoxAnnounceAllTiers,
81-
m_checkBoxMultiConnectionsPerIp, m_checkBoxValidateHTTPSTrackerCertificate, m_checkBoxSSRFMitigation, m_checkBoxBlockPeersOnPrivilegedPorts, m_checkBoxPieceExtentAffinity,
82-
m_checkBoxSuggestMode, m_checkBoxSpeedWidgetEnabled, m_checkBoxIDNSupport, m_checkBoxConfirmRemoveTrackerFromAllTorrents, m_checkBoxStartSessionPaused;
80+
m_checkBoxTrackerPortForwarding, m_checkBoxIgnoreSSLErrors, m_checkBoxConfirmTorrentRecheck, m_checkBoxConfirmRemoveAllTags, m_checkBoxAnnounceAllTrackers,
81+
m_checkBoxAnnounceAllTiers, m_checkBoxMultiConnectionsPerIp, m_checkBoxValidateHTTPSTrackerCertificate, m_checkBoxSSRFMitigation, m_checkBoxBlockPeersOnPrivilegedPorts,
82+
m_checkBoxPieceExtentAffinity, m_checkBoxSuggestMode, m_checkBoxSpeedWidgetEnabled, m_checkBoxIDNSupport, m_checkBoxConfirmRemoveTrackerFromAllTorrents,
83+
m_checkBoxStartSessionPaused;
8384
QComboBox m_comboBoxInterface, m_comboBoxInterfaceAddress, m_comboBoxDiskIOReadMode, m_comboBoxDiskIOWriteMode, m_comboBoxUtpMixedMode, m_comboBoxChokingAlgorithm,
8485
m_comboBoxSeedChokingAlgorithm, m_comboBoxResumeDataStorage, m_comboBoxTorrentContentRemoveOption;
8586
QLineEdit m_lineEditAppInstanceName, m_pythonExecutablePath, m_lineEditAnnounceIP, m_lineEditDHTBootstrapNodes;

src/webui/api/appcontroller.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ void AppController::preferencesAction()
374374
data[u"resolve_peer_countries"_s] = pref->resolvePeerCountries();
375375
// Reannounce to all trackers when ip/port changed
376376
data[u"reannounce_when_address_changed"_s] = session->isReannounceWhenAddressChangedEnabled();
377+
// Ignore SSL errors
378+
data[u"ignore_ssl_errors"_s] = pref->isIgnoreSSLErrors();
377379

378380
// libtorrent preferences
379381
// Bdecode depth limit
@@ -982,6 +984,9 @@ void AppController::setPreferencesAction()
982984
// Reannounce to all trackers when ip/port changed
983985
if (hasKey(u"reannounce_when_address_changed"_s))
984986
session->setReannounceWhenAddressChangedEnabled(it.value().toBool());
987+
// Ignore SLL errors
988+
if (hasKey(u"ignore_ssl_errors"_s))
989+
pref->setIgnoreSSLErrors(it.value().toBool());
985990

986991
// libtorrent preferences
987992
// Bdecode depth limit

src/webui/www/private/views/preferences.html

+10
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,14 @@
11321132
<input type="checkbox" id="markOfTheWeb" />
11331133
</td>
11341134
</tr>
1135+
<tr>
1136+
<td>
1137+
<label for="ignoreSSLErrors">QBT_TR(Ignore SSL errors:)QBT_TR[CONTEXT=OptionsDialog]</label>
1138+
</td>
1139+
<td>
1140+
<input type="checkbox" id="ignoreSSLErrors">
1141+
</td>
1142+
</tr>
11351143
<tr>
11361144
<td>
11371145
<label for="pythonExecutablePath">QBT_TR(Python executable path (may require restart):)QBT_TR[CONTEXT=OptionsDialog]</label>
@@ -2353,6 +2361,7 @@
23532361
$("refreshInterval").setProperty("value", pref.refresh_interval);
23542362
$("resolvePeerCountries").setProperty("checked", pref.resolve_peer_countries);
23552363
$("reannounceWhenAddressChanged").setProperty("checked", pref.reannounce_when_address_changed);
2364+
$("ignoreSSLErrors").setProperty("checked", pref.ignore_ssl_errors);
23562365
// libtorrent section
23572366
$("bdecodeDepthLimit").setProperty("value", pref.bdecode_depth_limit);
23582367
$("bdecodeTokenLimit").setProperty("value", pref.bdecode_token_limit);
@@ -2802,6 +2811,7 @@
28022811
settings["refresh_interval"] = Number($("refreshInterval").getProperty("value"));
28032812
settings["resolve_peer_countries"] = $("resolvePeerCountries").getProperty("checked");
28042813
settings["reannounce_when_address_changed"] = $("reannounceWhenAddressChanged").getProperty("checked");
2814+
settings["ignore_ssl_errors"] = $("ignoreSSLErrors").getProperty("checked");
28052815

28062816
// libtorrent section
28072817
settings["bdecode_depth_limit"] = Number($("bdecodeDepthLimit").getProperty("value"));

0 commit comments

Comments
 (0)