Skip to content

Commit

Permalink
add client.enterLocalPassiveMode parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
marevol committed Jan 9, 2025
1 parent a072873 commit 754407c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public class FtpClient extends AbstractCrawlerClient {

protected String trustManager;

protected boolean enterLocalPassiveMode;

@Override
public synchronized void init() {
if (ftpAuthenticationHolder != null) {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 754407c

Please sign in to comment.