自从发现Firefox在Windows和Linux平台上一直存在的一个未得到官方修复的autoproxy.pac文件解析bug之后,一直在探索临时的完美解决方案。终于,经过多次尝试后,发现了一个便捷的方法。其基本原理是利用hosts文件中对主机名的IP地址解析记录。为了免去每次手动修改/etc/hosts文件的麻烦,写了一小段脚本,代码如下:
以下代码仅在Ubuntu 9.04 + locale=en_US.UTF-8测试过!建议脚本小白使用前先备份/etc/hosts文件!
#!/bin/bash # modify hosts to adapt autoproxy hostname=`hostname` gw=`ip r | grep -w 'metric 1' | cut -d ' ' -f 12` line=$gw' '$hostname' #fix firefox autoproxy.pac bug' echo $line #debug only sed '/'$hostname'/d' /etc/hosts > tmp.txt mv tmp.txt /etc/hosts echo $line >> /etc/hosts
原创文章,转载请注明: 转载自猪在笑 [ http://www.huangwei.me/blog/ ]
本文链接地址: http://www.huangwei.me/blog/2010/03/24/firefox-autoproxy-pac-bug-fix/
最近评论