mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
ftp-client: Switch to binary mode before using the "SIZE" command.
* guix/ftp-client.scm (ftp-size): Add '%ftp-command' call.
This commit is contained in:
parent
661c99a434
commit
2a31e1dade
1 changed files with 6 additions and 1 deletions
|
@ -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 @@ (define (ftp-chdir conn dir)
|
|||
|
||||
(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))))
|
||||
|
|
Loading…
Reference in a new issue