Add a network -> proxy-dns-requests option.

Closes #330.
This commit is contained in:
Florian Bruhin 2014-12-16 23:27:55 +01:00
parent 7ccc69c0bc
commit 655ab31d48
2 changed files with 16 additions and 3 deletions

View File

@ -20,7 +20,7 @@
"""Handling of proxies."""
from PyQt5.QtNetwork import QNetworkProxyFactory
from PyQt5.QtNetwork import QNetworkProxy, QNetworkProxyFactory
from qutebrowser.config import config, configtypes
@ -45,6 +45,15 @@ class ProxyFactory(QNetworkProxyFactory):
"""
proxy = config.get('network', 'proxy')
if proxy is configtypes.SYSTEM_PROXY:
return QNetworkProxyFactory.systemProxyForQuery(query)
proxies = QNetworkProxyFactory.systemProxyForQuery(query)
else:
return [proxy]
proxies = [proxy]
for p in proxies:
if p.type() != QNetworkProxy.NoProxy:
capabilities = p.capabilities()
if config.get('network', 'proxy-dns-requests'):
capabilities |= QNetworkProxy.HostNameLookupCapability
else:
capabilities &= ~QNetworkProxy.HostNameLookupCapability
p.setCapabilities(capabilities)
return proxies

View File

@ -253,6 +253,10 @@ DATA = collections.OrderedDict([
"In addition to the listed values, you can use a `socks://...` or "
"`http://...` URL."),
('proxy-dns-requests',
SettingValue(typ.Bool(), 'true'),
"Whether to send DNS requests over the configured proxy."),
('ssl-strict',
SettingValue(typ.BoolAsk(), 'ask'),
"Whether to validate SSL handshakes."),