ftp-client: Default port for 'ftp-open' is now "ftp".

* guix/ftp-client.scm (ftp-open): Change default #:port to "ftp".
* guix/scripts/lint.scm (probe-uri): Remove 'port' parameter to
'ftp-open'.
This commit is contained in:
Ludovic Courtès 2015-11-22 14:35:28 +01:00
parent d6d33984df
commit 862d2479f6
2 changed files with 7 additions and 4 deletions

View File

@ -121,15 +121,18 @@ seconds to wait for the connection to succeed."
(raise-error errno))))) (raise-error errno)))))
(connect s sockaddr))) (connect s sockaddr)))
(define* (ftp-open host #:optional (port 21) #:key timeout) (define* (ftp-open host #:optional (port "ftp") #:key timeout)
"Open an FTP connection to HOST on PORT (a service-identifying string, "Open an FTP connection to HOST on PORT (a service-identifying string,
or a TCP port number), and return it. or a TCP port number), and return it.
When TIMEOUT is not #f, it must be a (possibly inexact) number denoting the When TIMEOUT is not #f, it must be a (possibly inexact) number denoting the
maximum duration in seconds to wait for the connection to complete; passed maximum duration in seconds to wait for the connection to complete; passed
TIMEOUT, an ETIMEDOUT error is raised." TIMEOUT, an ETIMEDOUT error is raised."
;; Use 21 as the default PORT instead of "ftp", to avoid depending on ;; Using "ftp" for PORT instead of 21 allows 'getaddrinfo' to return only
;; libc's NSS, which is not available during bootstrap. ;; TCP/IP addresses (otherwise it would return SOCK_DGRAM and SOCK_RAW
;; addresses as well.) With our bootstrap Guile, which includes a
;; statically-linked NSS, resolving "ftp" works well, as long as
;; /etc/services is available.
(define addresses (define addresses
(getaddrinfo host (getaddrinfo host

View File

@ -316,7 +316,7 @@ for connections to complete; when TIMEOUT is #f, wait as long as needed."
('ftp ('ftp
(catch #t (catch #t
(lambda () (lambda ()
(let ((conn (ftp-open (uri-host uri) 21 #:timeout timeout))) (let ((conn (ftp-open (uri-host uri) #:timeout timeout)))
(define response (define response
(dynamic-wind (dynamic-wind
(const #f) (const #f)