From 877189a909715f0102c7ecd7657c867fc9d00557 Mon Sep 17 00:00:00 2001 From: Shinsuke Sugaya Date: Thu, 9 Jan 2025 16:09:11 +0900 Subject: [PATCH] add client.enterLocalPassiveMode parameter --- .../org/codelibs/fess/crawler/client/ftp/FtpClient.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fess-crawler/src/main/java/org/codelibs/fess/crawler/client/ftp/FtpClient.java b/fess-crawler/src/main/java/org/codelibs/fess/crawler/client/ftp/FtpClient.java index 34925b1b..e3919d85 100644 --- a/fess-crawler/src/main/java/org/codelibs/fess/crawler/client/ftp/FtpClient.java +++ b/fess-crawler/src/main/java/org/codelibs/fess/crawler/client/ftp/FtpClient.java @@ -117,6 +117,8 @@ public class FtpClient extends AbstractCrawlerClient { protected String trustManager; + protected boolean enterLocalPassiveMode; + @Override public synchronized void init() { if (ftpAuthenticationHolder != null) { @@ -150,6 +152,7 @@ public synchronized void init() { useEPSVwithIPv4 = getInitParameter("useEPSVwithIPv4", false, Boolean.class); isImplicit = getInitParameter("isImplicit", null, Boolean.class); trustManager = getInitParameter("trustManager", null, String.class); + enterLocalPassiveMode = getInitParameter("enterLocalPassiveMode", false, Boolean.class); // ftp auth final FtpAuthenticationHolder holder = new FtpAuthenticationHolder(); @@ -506,6 +509,10 @@ protected FTPClient getClient(final FtpInfo info) throws IOException { throw new CrawlerLoginFailureException("Login Failure: " + auth.getUsername() + " for " + info.toUrl()); } + if (enterLocalPassiveMode) { + ftpClient.enterLocalPassiveMode(); + } + ftpClient.setFileType(FTP.BINARY_FILE_TYPE); return ftpClient; } catch (final IOException e) {