From e87bd3a7e7a00df990cce06e6f43badbc3442f55 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 21 Mar 2013 17:12:31 +0000 Subject: merge curl_download into Rpmdrake::edit_urpm_sources rationale: - it's its only user - it has nothing to do with curl since 2008 (and old XS curl code wasn't used anymore since 2003-05-12 when gurpm* stuff was merged in urpmi/gurpm*, grpmi/grpm.pl itself being killed on 2004-01-21) - gc was lazy --- Rpmdrake/edit_urpm_sources.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'Rpmdrake') diff --git a/Rpmdrake/edit_urpm_sources.pm b/Rpmdrake/edit_urpm_sources.pm index 46cab7b5..960ac7f4 100644 --- a/Rpmdrake/edit_urpm_sources.pm +++ b/Rpmdrake/edit_urpm_sources.pm @@ -552,8 +552,7 @@ sub proxy_callback { my $medium_name = $medium ? $medium->{name} : ''; my $w = ugtk2->new(N("Configure proxies"), grab => 1, center => 1, transient => $::main_window); local $::main_window = $w->{real_window}; - require curl_download; - my ($proxy, $proxy_user) = curl_download::readproxy($medium_name); + my ($proxy, $proxy_user) = readproxy($medium_name); my ($user, $pass) = $proxy_user =~ /^([^:]*):(.*)$/; my ($proxybutton, $proxyentry, $proxyuserbutton, $proxyuserentry, $proxypasswordentry); my $sg = Gtk2::SizeGroup->new('horizontal'); @@ -618,7 +617,7 @@ sub proxy_callback { $w->main and do { $something_changed = 1; - curl_download::writeproxy($proxy, $proxy_user, $medium_name); + writeproxy($proxy, $proxy_user, $medium_name); }; } @@ -1211,5 +1210,20 @@ packages as well?")); $res; } +sub readproxy (;$) { + my $proxy = get_proxy($_[0]); + ($proxy->{http_proxy} || $proxy->{ftp_proxy} || '', + defined $proxy->{user} ? "$proxy->{user}:$proxy->{pwd}" : ''); +} + +sub writeproxy { + my ($proxy, $proxy_user, $o_media_name) = @_; + my ($user, $pwd) = split /:/, $proxy_user; + set_proxy_config(user => $user, $o_media_name); + set_proxy_config(pwd => $pwd, $o_media_name); + set_proxy_config(http_proxy => $proxy, $o_media_name); + set_proxy_config(ftp_proxy => $proxy, $o_media_name); + dump_proxy_config(); +} 1; -- cgit v1.2.1