1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

WebView: Don't try to load invalid one-word urls

And also save the host lookup in case of invalid url.
This commit is contained in:
David Rosca 2015-11-06 23:42:23 +01:00
parent fb4782dab2
commit 27f0f9afac

View File

@ -176,13 +176,16 @@ void WebView::load(const LoadRequest &request)
!reqUrl.path().contains(QL1C(' ')) &&
!reqUrl.path().contains(QL1C('.'))
) {
// FIXME: This is blocking...
QHostInfo info = QHostInfo::fromName(reqUrl.path());
if (info.error() == QHostInfo::NoError) {
LoadRequest req = request;
req.setUrl(QUrl(QSL("http://") + reqUrl.path()));
loadRequest(req);
return;
QUrl u(QSL("http://") + reqUrl.path());
if (u.isValid()) {
// This is blocking...
QHostInfo info = QHostInfo::fromName(u.path());
if (info.error() == QHostInfo::NoError) {
LoadRequest req = request;
req.setUrl(u);
loadRequest(req);
return;
}
}
}