diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-03-19 13:00:04 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-03-19 13:00:21 +0100 |
commit | 2a31e1dadefc522d13b47c671254f706fb5ea3a6 (patch) | |
tree | 28203b4286a6abedd247c61d851680322d80e7f1 | |
parent | 661c99a434185d2e96c02d41f45faaa1f3458536 (diff) | |
download | guix-2a31e1dadefc522d13b47c671254f706fb5ea3a6.tar guix-2a31e1dadefc522d13b47c671254f706fb5ea3a6.tar.gz |
ftp-client: Switch to binary mode before using the "SIZE" command.
* guix/ftp-client.scm (ftp-size): Add '%ftp-command' call.
-rw-r--r-- | guix/ftp-client.scm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/guix/ftp-client.scm b/guix/ftp-client.scm index 761980ac8f..ab72405df0 100644 --- a/guix/ftp-client.scm +++ b/guix/ftp-client.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2010, 2011, 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -144,6 +144,11 @@ or a TCP port number), and return it." (define (ftp-size conn file) "Return the size in bytes of FILE." + + ;; Ask for "binary mode", otherwise some servers, such as sourceware.org, + ;; fail with 550 ("SIZE not allowed in ASCII mode"). + (%ftp-command "TYPE I" 200 (ftp-connection-socket conn)) + (let ((message (%ftp-command (string-append "SIZE " file) 213 (ftp-connection-socket conn)))) (string->number (string-trim-both message)))) |