Merge branch 'abbradar-more-pac'
This commit is contained in:
commit
21d2d04f45
@ -38,6 +38,7 @@ Fixed
|
||||
- Fixed hints sometimes not working with Qt 5.8
|
||||
- `:enter-mode` now refuses to enter modes which can't be entered manually (which caused crashes).
|
||||
- `:record-macro` (`q`) now doesn't try to record macros for special keys without a text.
|
||||
- Fixed PAC (proxy autoconfig) not working with QtWebKit
|
||||
|
||||
v0.9.1
|
||||
------
|
||||
|
@ -187,6 +187,7 @@ Contributors, sorted by the number of commits in descending order:
|
||||
* Oliver Caldwell
|
||||
* Julian Weigt
|
||||
* Sebastian Frysztak
|
||||
* Nikolay Amiantov
|
||||
* Jonas Schürmann
|
||||
* error800
|
||||
* Michael Hoang
|
||||
@ -197,7 +198,6 @@ Contributors, sorted by the number of commits in descending order:
|
||||
* Tomasz Kramkowski
|
||||
* Samuel Walladge
|
||||
* Peter Rice
|
||||
* Nikolay Amiantov
|
||||
* Ismail S
|
||||
* Halfwit
|
||||
* David Vogt
|
||||
|
@ -126,7 +126,7 @@ class _PACContext(QObject):
|
||||
return QHostAddress(QHostAddress.LocalHost).toString()
|
||||
|
||||
|
||||
class PACResolver(object):
|
||||
class PACResolver:
|
||||
|
||||
"""Evaluate PAC script files and resolve proxies."""
|
||||
|
||||
|
@ -614,7 +614,7 @@ def proxy_from_url(url):
|
||||
|
||||
scheme = url.scheme()
|
||||
if scheme in ['pac+http', 'pac+https']:
|
||||
return pac.PACFetcher
|
||||
return pac.PACFetcher(url)
|
||||
|
||||
types = {
|
||||
'http': QNetworkProxy.HttpProxy,
|
||||
|
@ -125,6 +125,43 @@ def test_invalid_port():
|
||||
res.resolve(QNetworkProxyQuery(QUrl("https://example.com/test")))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(string, ["", "{"])
|
||||
def test_wrong_pac_string(string):
|
||||
with pytest.raises(pac.EvalProxyError):
|
||||
pac.PACResolver(string)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", [
|
||||
"",
|
||||
"DIRECT FOO",
|
||||
"PROXY",
|
||||
"SOCKS",
|
||||
"FOOBAR",
|
||||
])
|
||||
def test_fail_parse(value):
|
||||
test_str_f = """
|
||||
function FindProxyForURL(domain, host) {{
|
||||
return "{}";
|
||||
}}
|
||||
"""
|
||||
|
||||
res = pac.PACResolver(test_str_f.format(value))
|
||||
with pytest.raises(pac.ParseProxyError):
|
||||
res.resolve(QNetworkProxyQuery(QUrl("https://example.com/test")))
|
||||
|
||||
|
||||
def test_fail_return():
|
||||
test_str = """
|
||||
function FindProxyForURL(domain, host) {
|
||||
return null;
|
||||
}
|
||||
"""
|
||||
|
||||
res = pac.PACResolver(test_str)
|
||||
with pytest.raises(pac.EvalProxyError):
|
||||
res.resolve(QNetworkProxyQuery(QUrl("https://example.com/test")))
|
||||
|
||||
|
||||
# See https://github.com/The-Compiler/qutebrowser/pull/1891#issuecomment-259222615
|
||||
|
||||
try:
|
||||
|
@ -765,7 +765,7 @@ class TestProxyFromUrl:
|
||||
@pytest.mark.parametrize('scheme', ['pac+http', 'pac+https'])
|
||||
def test_proxy_from_url_pac(self, scheme):
|
||||
fetcher = urlutils.proxy_from_url(QUrl('{}://foo'.format(scheme)))
|
||||
assert fetcher is pac.PACFetcher
|
||||
assert isinstance(fetcher, pac.PACFetcher)
|
||||
|
||||
@pytest.mark.parametrize('url, exception', [
|
||||
('blah', urlutils.InvalidProxyTypeError),
|
||||
|
Loading…
Reference in New Issue
Block a user