From c7e651be68a7be9eea93fde87dafac120bd1949d Mon Sep 17 00:00:00 2001 From: wtnabe Date: Wed, 30 Mar 2016 13:00:47 +0900 Subject: [PATCH] accept ftp:ssl-allow option for lftp for networks that data connection of ftp is caught by the firewall when authenticated with ssl --- lib/photocopier/ftp.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/photocopier/ftp.rb b/lib/photocopier/ftp.rb index 09fb801..e8e505e 100644 --- a/lib/photocopier/ftp.rb +++ b/lib/photocopier/ftp.rb @@ -42,15 +42,19 @@ def session def lftp(local, remote, reverse, exclude) remote = Shellwords.escape(remote) local = Shellwords.escape(local) - command = [ + cmds = [ "set ftp:list-options -a", - "set cmd:fail-exit true", + "set cmd:fail-exit true" + ] + cmds = cmds + ["set ftp:ssl-allow #{options[:'ssl-allow']}"] if !options[:"ssl-allow"].nil? + cmds = cmds + [ "open #{remote_ftp_url}", "find -d 1 #{remote} || mkdir -p #{remote}", "lcd #{local}", "cd #{remote}", lftp_mirror_arguments(reverse, exclude) - ].join("; ") + ] + command = cmds.join("; ") run "lftp -c '#{command}'" end