json Posted April 15, 2015 Share Posted April 15, 2015 it seems workflow support neither pac file nor https , even not allow me to set a port of a host file. i hope i can use the auto proxy by a pac file which is configged by system network setting. Link to comment Share on other sites More sharing options...
deanishe Posted May 15, 2015 Share Posted May 15, 2015 (edited) 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 May 15, 2015 by deanishe Link to comment Share on other sites More sharing options...
deanishe Posted June 28, 2015 Share Posted June 28, 2015 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 More sharing options...
deanishe Posted August 5, 2015 Share Posted August 5, 2015 Just had another idea. If you can get the proxy.pac URL from the system (which is simple enough), you could use pacparser to execute the proxy.pac file and determine the correct proxy settings. But I imagine it would slow your workflow down quite a bit. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now