SUMMARY LocalDomainUriFilter::filterUri is calling LocalDomainUriFilter::exists to determine whether it needs to prepend a "http://" to the specified uri. The exists function calls HostInfo::lookupHost, which returns a default constructed QHostInfo in the event of a timeout. The QHostInfo object returns QHostInfo::NoError by default when its error() method is called, causing LocalDomainUriFilter::exists to return true in the event of a DNS lookup timeout. This can lead to erroneous filtering in the event of a timeout. STEPS TO REPRODUCE 1. Run kiowidgets-kurifiltertest (maybe you need to do something to force a timeout. I'm not sure why it is happening for me and OBSERVED RESULT The effect of this is the kiowidgets-kurifiltertest autotest fails in my case: filtering "KDE" to "http://KDE" because the lookup on "KDE" times out (qt would take 5 seconds to time out, but kio aborts the lookup after 1.5 seconds). EXPECTED RESULT Not sure if LocalDomainUriFilter::exists should be updated (maybe it breaks something) or if the autotests should or if my getaddressinfo is just acting strangely. Intuitively I would expect LocalDomainUriFilter::exists to return false on timeout. SOFTWARE/OS VERSIONS Linux/KDE Plasma: (available in About System) KDE Plasma Version: 5.18.5 KDE Frameworks Version: git master Qt Version: git branch 5.14
https://invent.kde.org/snippets/937
Proposed fix https://invent.kde.org/frameworks/kio/-/merge_requests/14
Git commit 576b612e0d3e3f12457bc17592f696630b433188 by Ahmad Samir. Committed on 27/05/2020 at 07:09. Pushed by dfaure into branch 'master'. [HostInfo] Set QHostInfo::HostNotFound when a host isn't found in the DNS cache Here is the chain, AFAIU, in order: LocalDomainUriFilter::exists() KUriFilterPlugin::resolveName() KIO::HostInfo::lookupHost() HostInfo::lookupCachedHostInfoFor() the latter would return a default constructed QHostInfo object, calling error() on it would return QHostInfo::NoError, which is wrong since we didn't find that host in the KIO DNS cache. This made the KUriFilterTest::executables unit test fail when there's something with the connection and both the DNS lookup times out and the host can't be found the KIO cache. Thanks to Ben Gruber in the bug report for figuring it out. I've verified the whole sequence by following the code via gdb. FIXED-IN: 5.71.0 M +4 -1 src/core/hostinfo.cpp https://invent.kde.org/frameworks/kio/commit/576b612e0d3e3f12457bc17592f696630b433188