Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically fallback to DIRECT when PAC unavailable #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion px/pac.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ def find_proxy_for_url(self, url, host):
Return comma-separated list of proxy servers to use for this url
DIRECT can be returned as one of the options in the response
"""
proxies = self.ctxt.eval("FindProxyForURL")(url, host)
try:
proxies = self.ctxt.eval("FindProxyForURL")(url, host)
except quickjs.JSException:
dprint("Could not evaluate PAC file, falling back to DIRECT...")
return "DIRECT"

# Fix #160 - convert PAC return values into CURLOPT_PROXY schemes
for ptype in ["PROXY", "HTTP"]:
Expand Down