You are here

committing to subversion from behind a dodgy proxy

I was recently doing some work in a hotel, and when I came to commit my changes back to my central subverson repository using git-svn, I got an error message that looked a lot like this:

Committing to http: //example.com/top_secret_svn_repo/trunk ... RA layer request failed: Server sent unexpected return value (400 Bad Request) in response to MKACTIVITY request for '/top_secret_svn_repo/trunk/!svn/act/7cc9df3f-2956-3669-8f25-45c093142061' at /usr/lib/git-core/git-svn line 3347

Putting (parts of) this error message into my favourite search engine yielded a few results suggesting the problem was a result of my being behind a proxy. I found a good explanation in a post on the subversion forums:

[subversion uses]... esoteric HTTP methods such as "OPTIONS", "PROPFIND" and "REPORT". If you have an HTTP proxy on your network, it is possible for it to be configured to allow the standard "GET" and "POST" HTTP methods, but to disallow the WebDAV methods that ...[interacting with]... a Subversion repository requires.

This made sense - the hotel I was in seemed to be using a squid proxy which had caused me one or two other problems.

I found a workaround in a post in a mail archive which looks like it will work for plain vanilla SVN as well as git-svn. I had to add a couple of lines to my subversion config at ~/.subversion/servers - something like this:

mygroup = example.com [mygroup] http-proxy-host = localhost http-proxy-port = 3128

...where example.com is the host where subversion's running. I then used an SSH tunnel to a machine running squid so that I could point subversion at port 3128 on localhost and have it talk to the proxy on the other end of the tunnel, which in turn spoke to the subversion server for me. Something like this:

mcdruid@laptop:~> ssh -L3128:localhost:3128 -C machine-running-squid.co.uk

...this only worked because the instance of squid I was now using was not configured to disallow the esoteric HTTP methods used by subversion.

All that remained was to remember to comment out those lines in ~/.subversion/servers when I checked out of the hotel (no bad version control pun intended).