guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] svn-download: Respect current-http-proxy when downloadin


From: Ludovic Courtès
Subject: Re: [PATCH 1/2] svn-download: Respect current-http-proxy when downloading.
Date: Sun, 28 Feb 2016 17:44:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Jookia <address@hidden> 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-host"
>   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 leaks.
> * guix/svn-download.scm (svn-fetch): Leak the http_proxy environment variable.

Sorry for the delay, and thanks for the useful patch!

I gather ‘svn’ doesn’t honor ‘http_proxy’ in the first place, right?
That would have simplified things.

Also, what about ‘https_proxy’?  (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=")
> +                 (config-port "servers:global:http-proxy-port="))
> +        `("--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 …)
modules, which are not involved here.

Also, I’m not a fan of SRFI-2.  :-)  So I’d 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=servers:global:http-proxy-host="
              host)
             (string-append
              "--config-option=servers:global:http-proxy-port="
              (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’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]