[BUG] http proxy overriding problem / env var problem on the other OS

K Thananchayan thananck at yahoo.com
Fri Aug 5 01:37:58 CDT 2005


Hi,

--- Edouard Gomez <ed.gomez at free.fr> wrote:

> Selon K Thananchayan <thananck at yahoo.com>:
> > What is your OS version?
> 
> Win2k SP4 + all Windows Updates up to the Microsoft
> Update service appearance
> (doesn't work at all for me)

Interesting! By the way, are you using stock python
from python.org?

> > You might want to try the attached patch. It
> basically
> > ignores any exceptions thrown by del
> os.environ[env].
> > However, in your case os.environment might still
> have
> > the entry intact.
> >
> > After applying the patch, would you mind running
> hg
> > again with the print statements I suggested
> earlier
> > with the following statment appended.
> >          print "ui.cdata._sections",
> > ui.cdata._sections
> > The output should help in figuring out what is
> > happening?
> 
> No attachment sent :-)

Sorry. Please try the attached patch. I have also
include some debug print statements to verify that
hgrc settings override those of env.

My digging seem to suggest that this is the case.

> Thanks
> 
> --
> Edouard Gomez


Hope this is helpful.

Thanks.

-thanan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
diff -r 5a55e3011772 mercurial/hg.py
--- a/mercurial/hg.py	Sat Jul 30 17:01:59 2005
+++ b/mercurial/hg.py	Fri Aug 05 14:36:22 2005
@@ -1747,9 +1747,16 @@
 
         # Note: urllib2 takes proxy values from the environment and those will
         # take precedence
-        for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
+        print "Proxy environment vars: ", ["%s=%s" % (var, os.environ.get(var))
+                                           for var in ["HTTP_PROXY","NO_PROXY",
+                                                       "http_proxy","no_proxy"]]
+        for env in ["HTTP_PROXY", "http_proxy", "NO_PROXY", "no_proxy"]:
             if os.environ.has_key(env):
-                del os.environ[env]
+                try:
+                    del os.environ[env]
+                except:
+                    print "Failed to delete environment variable %s" % env
+                    pass
 
         proxy_handler = urllib2.BaseHandler()
         if host and not no_proxy:
@@ -1763,6 +1770,13 @@
 
         opener = urllib2.build_opener(proxy_handler, authinfo)
         urllib2.install_opener(opener)
+        print "Proxy environment vars: ", ["%s=%s" % (var, os.environ.get(var))
+                                           for var in ["HTTP_PROXY","NO_PROXY",
+                                                       "http_proxy","no_proxy"]]
+        print "opener: ", urllib2._opener.handle_open
+        print "proxy handler: ", proxy_handler
+        print "proxy_handler.http_open default args: ", proxy_handler.http_open.func_defaults
+        print "hgrc proxy settings: ", ui.cdata._sections.get("http_proxy")
 
     def dev(self):
         return -1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pull.output
Type: application/octet-stream
Size: 1348 bytes
Desc: 52124919-pull.output
Url : http://www.selenic.com/pipermail/mercurial/attachments/20050804/05ad5de8/pull.obj


More information about the Mercurial mailing list