From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 1/2] svn-download: Respect current-http-proxy when downloading. Date: Sun, 28 Feb 2016 17:44:18 +0100 Message-ID: <871t7wwzrx.fsf@gnu.org> References: <56c321a5.8445620a.d0d47.3c13@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aa4SG-00010L-OW for guix-devel@gnu.org; Sun, 28 Feb 2016 11:44:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aa4SD-0006Eq-Fg for guix-devel@gnu.org; Sun, 28 Feb 2016 11:44:24 -0500 In-Reply-To: <56c321a5.8445620a.d0d47.3c13@mx.google.com> (Jookia's message of "Tue, 16 Feb 2016 23:37:57 +1100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Jookia <166291@gmail.com> Cc: guix-devel@gnu.org Jookia <166291@gmail.com> skribis: > When downloading a repository through SVN over HTTP, do it using a proxy = if > possible. This is especially useful for people who use Tor to do all their > downloading. This doesn't work with svn:// repositories to my knowledge. > > * guix/build/svn.scm (svn-fetch): Pass the "servers:global:http-proxy-hos= t" > and "servers:global:http-proxy-port" configuration options to SVN if > current-http-proxy is set. Bail if unable to parse the proxy to avoid l= eaks. > * guix/svn-download.scm (svn-fetch): Leak the http_proxy environment vari= able. Sorry for the delay, and thanks for the useful patch! I gather =E2=80=98svn=E2=80=99 doesn=E2=80=99t honor =E2=80=98http_proxy=E2= =80=99 in the first place, right? That would have simplified things. Also, what about =E2=80=98https_proxy=E2=80=99? (This could be left for a = subsequent patch, if you prefer.) [...] > + (define proxy-config > + (if (current-http-proxy) > + (and-let* ((proxy-uri (string->uri (current-http-proxy))) > + (proxy-host (uri-host proxy-uri)) > + (proxy-port (number->string (uri-port proxy-uri))) > + (config-host "servers:global:http-proxy-host=3D") > + (config-port "servers:global:http-proxy-port=3D")) > + `("--config-option" ,(string-append config-host proxy-host) > + "--config-option" ,(string-append config-port proxy-port))) > + '())) I would suggest using an explicit (getenv "http_proxy") instead of (current-http-proxy) since the latter is specific to the (web =E2=80=A6) modules, which are not involved here. Also, I=E2=80=99m not a fan of SRFI-2. :-) So I=E2=80=99d write it as: (match (getenv "http_proxy") (#f '()) (uri-string (let* ((uri (string->uri uri-string)) (host (uri-host uri)) (port (uri-port uri))) (list (string-append "--config-option=3Dservers:global:http-proxy-host=3D" host) (string-append "--config-option=3Dservers:global:http-proxy-port=3D" (number->string port)))))) Probably with something like: (unless uri (format (current-error-port) "invalid HTTP proxy URI: ~s~%" uri-string) (exit 1)) Could you send an updated patch? Thanks! Ludo=E2=80=99.