Subject: bug#26191: Allow custom FTP logins.

From: [email-masked] (Ludovic Courtès)
Date: Mon, 20 Mar 2017 21:30:52 +0100

Roel Janssen <[email-masked]> skribis:

> From 8536ba69ec3a04930e8a78c8f2b824df3e8c0454 Mon Sep 17 00:00:00 2001
> From: Roel Janssen <[email-masked]>
> Date: Mon, 20 Mar 2017 12:57:25 +0100
> Subject: [PATCH 1/2] ftp-client: Allow custom username and password for FTP
>  servers.
>
> * guix/ftp-client.scm (ftp-open): Add username and password arguments.

OK!

> From e7263ce1d1a242f187c9801b14ea47043f59be8e Mon Sep 17 00:00:00 2001
> From: Roel Janssen <[email-masked]>
> Date: Mon, 20 Mar 2017 12:59:59 +0100
> Subject: [PATCH 2/2] download: Handle username and password properties for FTP
>  uris.
>
> guix/build/download.scm (ftp-fetch): Process username and password from a URI.

[...]

> +  (let* ((userinfo (string-split (uri-userinfo uri) #\:))
> +         (username (if (and (> (length userinfo) 0)
> +                            (not (string= (car userinfo) "")))
> +                       (car userinfo) #f))
> +         (password (if (> (length userinfo) 1) (cadr userinfo) #f))
> +         (conn (ftp-open (uri-host uri) #:timeout timeout
> +                                        #:username username
> +                                        #:password password))

Of course I have to agree with Danny here regarding ‘match’.  ;-)

  (let ((user (match userinfo
                (() #f)
                (("") #f)
                (((? string? user)) user)))
        (pass (match userinfo
                 …)))
    …)

OK with a change along these lines.

Thank you!

Ludo’.