Skip to content

Commit 1f2abb4

Browse files
Mrs-XWarrows
authored andcommitted
[Qt] Additional proxy checks in options-dialog
1 parent 64f759e commit 1f2abb4

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,12 +1171,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
11711171
if (proxyArg != "" && proxyArg != "0") {
11721172
CService proxyAddr;
11731173
if (!Lookup(proxyArg.c_str(), proxyAddr, 9050, fNameLookup)) {
1174-
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
1174+
return InitError(strprintf(_("Lookup(): Invalid -proxy address or hostname: '%s'"), proxyArg));
11751175
}
11761176

11771177
proxyType addrProxy = proxyType(proxyAddr, proxyRandomize);
11781178
if (!addrProxy.IsValid())
1179-
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
1179+
return InitError(strprintf(_("isValid(): Invalid -proxy address or hostname: '%s'"), proxyArg));
11801180

11811181
SetProxy(NET_IPV4, addrProxy);
11821182
SetProxy(NET_IPV6, addrProxy);

src/qt/optionsdialog.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -305,22 +305,32 @@ void OptionsDialog::doProxyIpChecks(QValidatedLineEdit* pUiProxyIp, QLineEdit* p
305305
const std::string strAddrProxy = pUiProxyIp->text().toStdString();
306306
CService addrProxy;
307307

308-
/* Check for a valid IPv4 / IPv6 address */
308+
// Check for a valid IPv4 / IPv6 address
309309
if (!(fProxyIpValid = LookupNumeric(strAddrProxy.c_str(), addrProxy))) {
310310
disableOkButton();
311311
pUiProxyIp->setValid(false);
312312
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
313313
ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
314-
} else {
315-
if (!pUiProxyPort->hasAcceptableInput()){
316-
disableOkButton();
317-
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
318-
ui->statusLabel->setText(tr("The supplied proxy port is invalid."));
319-
} else {
320-
enableOkButton();
321-
ui->statusLabel->clear();
322-
}
314+
return;
315+
}
316+
// Check proxy port
317+
if (!pUiProxyPort->hasAcceptableInput()){
318+
disableOkButton();
319+
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
320+
ui->statusLabel->setText(tr("The supplied proxy port is invalid."));
321+
return;
322+
}
323+
324+
proxyType checkProxy = proxyType(addrProxy);
325+
if (!checkProxy.IsValid()) {
326+
disableOkButton();
327+
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
328+
ui->statusLabel->setText(tr("The supplied proxy settings are invalid."));
329+
return;
323330
}
331+
332+
enableOkButton();
333+
ui->statusLabel->clear();
324334
}
325335

326336
bool OptionsDialog::eventFilter(QObject* object, QEvent* event)

0 commit comments

Comments
 (0)