IE proxy settings extension

TK Soh teekaysoh at gmail.com
Fri Nov 5 05:39:19 CDT 2010


On Fri, Nov 5, 2010 at 3:34 PM, TK Soh <teekaysoh at gmail.com> wrote:
> On Fri, Nov 5, 2010 at 3:06 PM, TK Soh <teekaysoh at gmail.com> wrote:
>> On Thu, Nov 4, 2010 at 8:26 PM, Mads Kiilerich <mads at kiilerich.com> wrote:
>>> On 11/03/2010 10:46 PM, Steve Borho wrote:
>>>>
>>>> Attached is an extension that I've just written with the intention of
>>>> automatically reading proxy settings from the Internet Explorer's
>>>> registry configuration.   In many corporate environments, proxies are
>>>> configured to be discovered by DHCP and friends.  If the user enables
>>>> this extension, Mercurial will also autodetect these settings and
>>>> stuff "just works".
>>>>
>>>> I've run it on my Windows machines, but I do not use proxies so it
>>>> doesn't do much. I'm hoping some people who do use proxies can test
>>>> this for me and give me some feedback on what works and what doesn't.
>>>>
>>>> You can either run this as a standalone script, or enable it as an
>>>> extension and try some command line hg commands.
>>>
>>> Here be dragons...
>>>
>>> I had to do something like what is attached in order to make proxy detection
>>> work reliably on windows in corporate environments. It is so big and ugly
>>> that I don't think it belongs in core Mercurial, but an extension would be
>>> fine.
>>>
>>> Feel free to use the attached code, but please let me know if you have
>>> comments or fixes to it.
>>>
>>> (The next problem once the proxy has been detected is to get transparent
>>> proxy authentication with NTLM or Negotiate...)
>>
>> I got the error below when running the original script:
>>
>>      File "proxy_detection.py", line 211
>>        print = """For PAC testing put this script on a web server and
>> configure win
>>    dows to use its url for automatic configuration:
>>              ^
>>    SyntaxError: invalid syntax
>>
>> Otherwise it works great after removing the '=' char. Can you help
>> turn it into an extension? Surely it can get cleaned up over time.
>
> BTW, one issue that's been bugging me for awhile is the need to store
> the proxy password into hgrc, since in my case it's actually the same
> as the windows active-directory password. Somehow when I use the same
> proxy server on the web browser (IE & Firefox), I am not required to
> provide these info. I am no expert on this topic, it'd great if some
> guru out there is able to create an Mercurial extension that can
> handle proxy in the similar way, include bypassing the proxy server
> automatically when I have direct connection to the internet while I am
> not within the company network.

Out of curiosity, I did some QnD hack to turn the script into a
Mercurial extension. Nothing fancy, but it is able to detect the
proxy's existence and set http_proxy.host accordingly. Tested with hg
incoming on the stable repo. Script attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proxy_detection.py
Type: application/octet-stream
Size: 10071 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20101105/c6690c2f/attachment.obj>


More information about the Mercurial-devel mailing list