Wednesday, February 26, 2014

Tool Posting: Quicklisp with an Authenticating Proxy

(To regular readers of this blog who are looking for basketball content -- this posting is in my occasional series on the tools I use, and may not be of interest.  On the other hand, if you found this posting Googling for a workaround for an authenticating proxy in Quicklisp, you're in the right place!)

Quicklisp is a great tool for installing packages into Common Lisp.  Unfortunately, it doesn't work with authenticating proxies, which is a bother in many environments. However, there's a fairly straightforward workaround to fix this.

The basic idea is to insert a new proxy between Quicklisp and the authenticating proxy.  Quicklisp will talk to the new proxy without authentication, and the new proxy will take care of authenticating with the real proxy.There are probably several different proxies you can use to do this, but I chose DeleGate.  It's free to use for non-commercial use.  Download Delegate, install it, and then start it with the following command line:

delegate -P8091 SERVER=http PROXY="realProxy:8080:*" MYAUTH="username:password" ADMIN="" 

This says to start delegate as an HTTP proxy on port 8091, forwarding all requests to port 8080 on the realProxy, using the authentication provided in MYAUTH.  (The ADMIN parameter is just an email address required by Delegate, you can put in whatever you'd like.)  Obviously you'll need to fill in the address of your existing proxy and the correct username and password for that proxy.
Once Delegate is running, you can install Quicklisp as follows:

(quicklisp-quickstart:install :proxy "http://localhost:8081/")

This directs Quicklisp to the new Delegate proxy.  Delegate connects to the real proxy using the username and password you provided, and then just passes along the requests.  The result is that Quicklisp doesn't have to talk directly to the authenticating proxy.

It's worth noting that whatever proxy specification you use when running quicklist-quickstart:install will be used by Quicklisp from then on.  If you ever need to change your proxy, you do it like so:

(setf (ql-config:config-value "proxy-url") "")

Under Windows, you can set up Delegate as a service that will run every time Windows starts or just start it manually whenever you want to use Quicklisp.  The same trick will work for other programs that don't know how to interact with an authenticating proxy.

1 comment: