Fwd: using an http proxy?

Bryan Blackburn blb at macports.org
Fri Mar 28 00:48:59 PDT 2008


Rainer Müller wrote on the MacPorts Users list:
>
> Bryan Blackburn wrote:
>> If you set the standard curl proxy environment variables (http_proxy,
>> FTP_PROXY, etc; see 'man curl'), this should get fetching of sources
>> to work through the proxy.
>
> According to ticket #13158 [1], you have to specify your proxy on the
> command line if using sudo, as it normally unsets environment  
> variables:
>
> $ sudo env http_proxy='foobar' port fetch $portname
>

I've just attached a patch to that ticket which should solve the proxy/ 
root issue.  Basically, what it does is query the SystemConfiguration  
framework for the proper HTTP, HTTPS, and FTP proxy information (as  
well as names which should skip the proxy) and sets the proper libcurl  
environment variables appropriately.

This is an issue on, I believe, 10.5 clean-install systems; my MBP was  
upgraded to 10.5 and didn't initially see it, as /etc/sudoers is left  
alone on an upgrade.  If you clean install, the 10.5 sudoers cleans  
the environment, hence proxy-related variables not working through sudo.

It was mentioned in the ticket that using the scutil command might be  
a good idea, but since that then requires parsing the output of  
another command, it could run into issues.  My patch just adds to  
MacPorts (the Pextlib.dylib) what scutil does when querying for proxy  
information.

Not to mention this makes it a bit more Mac-like since people no  
longer have to update .profile (or equivalent) when updating proxies,  
and it of course should follow location changes...

Any comments?

Bryan


> ...
> Rainer
>
> [1] http://trac.macosforge.org/projects/macports/ticket/13158
>


More information about the macports-dev mailing list