all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Jookia <166291@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 1/2] svn-download: Respect current-http-proxy when downloading.
Date: Sun, 28 Feb 2016 17:44:18 +0100	[thread overview]
Message-ID: <871t7wwzrx.fsf@gnu.org> (raw)
In-Reply-To: <56c321a5.8445620a.d0d47.3c13@mx.google.com> (Jookia's message of "Tue, 16 Feb 2016 23:37:57 +1100")

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-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	other threads:[~2016-02-28 16:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 12:37 [PATCH 1/2] svn-download: Respect current-http-proxy when downloading Jookia
2016-02-28 16:44 ` Ludovic Courtès [this message]
2016-02-28 21:45   ` Jookia
2020-03-15 11:22     ` levenson
2020-03-15 12:45       ` Jookia
2020-03-15 18:04       ` Leo Famulari
2016-03-03  4:32   ` Jookia
2016-03-03 16:39     ` Ludovic Courtès
2016-03-03 16:44       ` Jookia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871t7wwzrx.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=166291@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.