解决subclipse通过http proxy访问subversion服务器的问题

在eclipse中使用subclipse,发现无法访问到目标subversion服务器,总是报服务器无法连接。我连的subversion服务器采用apache以http的形式发布,用浏览器直接打开URL可以访问。由于公司网络环境是要求使用http proxy的,因此第一个想法就是eclipse没有使用http proxy因此无法连接外网。

        简单验证了一下,用eclipse的software update工具,试图访问外部站点获取更新信息,报错无法访问。问题确认,找了一下eclipse的配置,window -》prererences-》General -》Network Connections 下,有网络连接的设置,默认是"Direct connection to the Internet"/直接访问因特网。

        这样当然出不去了,随即修改为公司目前使用的http proxy,测试了一下software update可以正常工作。中间有个小插曲,http proxy设置中,proxy.***.com前千万不要加"http://",否则无法使用,因为这个原因浪费了不少时间。但是再试subclipse连接subversion服务器时,还是同样的报错,无法连接到服务器。晕......

        google了一下没有找到直接答案,花了点时间最后找到了subversion的FAQ,发现有下面这么一段:

        http://subversion.tigris.org/faq.html#proxy
        What if I'm behind a proxy?

The Subversion client can go through a proxy, if you configure it to do so. First, edit your "servers" configuration file to indicate which proxy to use. The files location depends on your operating system. On Linux or Unix it is located in the directory "~/.subversion". On Windows it is in "%APPDATA%\Subversion". (Try "echo %APPDATA%", note this is a hidden directory.)

There are comments in the file explaining what to do. If you don't have that file, get the latest Subversion client and run any command; this will cause the configuration directory and template files to be created.

        言下之意,subversion客户端访问外网时,http proxy的设置是通过“%APPDATA%\Subversion\servers”这里来设置的,eclipse的设置对它无效!

        不说二话,直接找到“%APPDATA%\Subversion\servers”文件,因为我这里情况简单,直接修改最下面的[global]设置,打开注释并修改为当前环境下的http-proxy

http-proxy-host = iproxy-sh.****.se
http-proxy-port = 8080

        再试就ok了,成功连接到subversion服务器。

        PS: 中间还看到,subversion使用到一些特殊的http head,比如PROPFIND, REPORT, MERGE, MKACTIVITY, CHECKOUT。对于某些无法支持这些header的http proxy,需要使用其他的方法,比如使用https。由于暂时没有遇到这个问题,不花时间研究了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值