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:
parent
fb4782dab2
commit
27f0f9afac
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user