Jump to content

support .pac or port of a host


Recommended Posts

  • 1 month later...

Alfred passes your system proxy settings to workflows via the standard http_proxy and https_proxy environmental variables if you have properly configured Web Proxy and Secure Web Proxy in your Network settings. UNIX-y tools like curl, Python etc. will use the proxy automatically.
Unfortunately, Alfred can't realistically handle proxies configured via a proxy.pac file for your workflow because of the way proxy.pac autoconfiguration works.
A proxy.pac file is a JavaScript program that defines a FindProxyForURL(url, host) function which the client calls before every request to get the appropriate proxy. Alfred can't do that for your workflow because it has no idea the workflow is opening a URL, let alone which one. It's basically up to you and whatever language you're writing your workflow in.
Alfred could provide the URL of the proxy.pac file, but it'd still be up to your workflow to provide a JavaScript environment (that implements all the proxy.pac functions) to execute it in.
The best solution I can think of would be a small, native command-line utility that you can pass a URL and it will return the appropriate proxy for you based on the system configuration. OS X's HTTP libraries take care of all the proxy settings for you, including proxy.pac, so it might be possible to initialise a connection with a URL and then extract the computed proxy address.
I will look into it later this afternoon. Hopefully, it's possible to get at the computed proxy without actually opening a connection.

Edited by deanishe
Link to comment
Share on other sites

  • 1 month later...

I couldn't find a way to pull the actual computed proxy details out of Cocoa (as opposed to the auto-configuration URL). I'm pretty clueless with Objective-C and Cocoa, mind you.

Someone who knows it better might have more luck.

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...