TortoiseSVN through a proxy script

2019-03-19 02:34发布

问题:

I'm attempting to connect to a remote HTTPS SVN server from inside a corporate firewall using TortoiseSVN. I am required to use a proxy for this connection. My problem is that TortoiseSVN's proxy settings only include an option to set a direct proxy server address. The proxy I am connecting through, however, is configured via a script. In Firefox, for example, I use the "Automatic proxy configuration URL" option in the network settings.

Is there any way to use a proxy configuration scripts with Tortoise? I can't find one in the config UI - is there a way to configure it through editing a config file?

回答1:

There may be a cleaner way to do this but you could simply get the URL of the automatic configuration file from your firefox settings and open it: .pac files are raw text with a fairly simple syntax.

Extracting the ip/port and other configuration info for your corporate proxy from that file should be relatively simple (look for the one that applies to your IP range if there are more than one).

Obviously, this isn't very pretty in the sense that, if the proxy configuration changes, you'll have to do this again instead of benefiting from the automated settings. In practice, this simple trick has been very useful for everything from Putty to TortoiseSVN for me !



回答2:

AFAIK TortoiseSVN and Subversion in general lacks direct support for proxy configuration scripts (aka *.pac files).

As mentioned in the accepted answer, you can download the proxy config script, extract the matching rule from the configuration and set it as proxy, but this workaround has two drawbacks:

  1. Whenever your sysadmins change the config script, you will run into connectivity problems, which will take time to diagnose, then you'll have to take another look at the configuration script, change your settings, etc.

  2. If the SVN servers used fall under multiple proxy configuration rules resulting in multiple proxy servers used, you will have to change your TSVN proxy settings whenever you want to connect to another SVN server.

Now the former problem (maintenance) is beyond what I could solve, but the latter (sophisticated proxy config), may be tackled using Subversion's servers configuration file, which is itself a kind of proxy configuration file. The file can be reached via context menu / TortoiseSVN / Settings / Network tab / Subversion server file / Edit button.

The default servers file is pretty well commented, including some examples. Two important features to look for are groups and the http-proxy-exceptions setting. Using the servers file you will be able to set up simple proxy rules based on the original proxy configuration script.

The official Subversion FAQ also mentions the servers file.