diff options
author | Florian Bruhin <me@the-compiler.org> | 2019-11-27 17:05:49 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-11-27 17:05:49 +0100 |
commit | f80be92f6558963749eddc18b87758ca7521d137 (patch) | |
tree | 204e328c725d0727a2a529f9f48c0a1341880991 /qutebrowser/utils/urlutils.py | |
parent | a97de9c62a799dc6a99ab4439219963b3d1cb550 (diff) | |
parent | 8d9d8ef6ebb81a4e79cd5ff2d5850a525ffc5f6b (diff) | |
download | qutebrowser-f80be92f6558963749eddc18b87758ca7521d137.tar.gz qutebrowser-f80be92f6558963749eddc18b87758ca7521d137.zip |
Merge remote-tracking branch 'origin/pr/4707' into domain-mapping
Diffstat (limited to 'qutebrowser/utils/urlutils.py')
-rw-r--r-- | qutebrowser/utils/urlutils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index 2908327dd..51f0fd6cc 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -617,3 +617,12 @@ def proxy_from_url(url: QUrl) -> QNetworkProxy: if url.password(): proxy.setPassword(url.password()) return proxy + + +def widened_hostnames(hostname: str) -> typing.Iterable[str]: + """A generator for widening string hostnames. + + Ex: a.c.foo -> [a.c.foo, c.foo, foo]""" + while hostname: + yield hostname + hostname = hostname.partition(".")[-1] |