Jump to content
M-Brig

Auto Passive Mode and Passive Mode requesting a DIR

Recommended Posts

Hello, we have been using ICS FTP client component for over 10 years in Delphi and all is working well. The last version we installed in the compiler is dated 13 February 2013. 

However, we recently encountered a problem requesting a directory from an FTP server. The ICS FTP component requests the directory in auto passive mode and the FTP server rejects that request then the component disconnects.

We have another application that uses the C # Fluent FTP Client. When this component requests a directory in auto passive mode the server rejects it then the component switches to passive mode and gets the LIST just fine.

Does the latest ICS FTP Client component handle this switch when requesting the directory from the server. We just downloaded the Version 9.3.

 Thanks for all your help.

Share this post


Link to post
19 minutes ago, M-Brig said:

The ICS FTP component requests the directory in auto passive mode and the FTP server rejects that request then the component disconnects.

What is "auto passive mode"? Do you mean "Active" mode?  "Active" (server connects to client) and "Passive" (client connects to server) are the 2 modes defined by the FTP protocol, and "Active" is the default.  "Active" mode is not friendly to NATs, which are commonly used nowadays, so it is best to just always use "Passive" mode only.

Edited by Remy Lebeau

Share this post


Link to post

Thanks Remy as always. Your a great help to the Delphi community. My apologies I mixed up the terminology. The difference modes are Passive (PASV) and Extended Passive mode (EPSV). The C # component first request the directory using EPSV. This request is rejected then the component requests the directory in PASV mode and receives the full directory. The ICS FTP component I think is only requesting the directory in EPSV mode and when that is rejected it disconnects from the server. We can get the extract log on what happens during the C # program. Anyway, do you know if this is handled in the latest version, 9.3? We are trying to determine do we upgrade our current component (ICS), which we would prefer or purchase a new component,

 

Thanks for all your help.

Share this post


Link to post

Extended Passive mode (EPSV) is for IPv6 connections, I'm not aware it has any purpose for IPv4 if that is what you are using. 

 

Never heard of active passive mode, can you please show the ICS FTP log.

 

Angus

 

Share this post


Link to post
3 hours ago, M-Brig said:

The difference modes are Passive (PASV) and Extended Passive mode (EPSV).

That makes more sense.

3 hours ago, M-Brig said:

Anyway, do you know if this is handled in the latest version, 9.3?

I just looked at the latest 9.3 source code, and no, I do not believe it does.  For one thing, it is not checking if the server actually supports EPSV before sending that command.  And second, it does not appear to switch to PASV when EPASV fails.

Share this post


Link to post
3 hours ago, Angus Robertson said:

Extended Passive mode (EPSV) is for IPv6 connections, I'm not aware it has any purpose for IPv4 if that is what you are using.

EPSV is not limited to just IPv6, it can be used for IPv4 as well.

 

But also, EPSV has another benefit even for IPv4 - it has a well-defined machine-parsable response text, whereas PASV does not.  PASV responses are harder to parse since different servers use different formats for their reply text, and there are quite a few different formats in use in practice.

Share this post


Link to post

It is up to the FTP client to decide whether to start passive mode with a PASV or EPSV command, the former has worked with IPv4 for decades, the latter is required for IPv6 so no check for availability is needed.  None of this has changed in ICS in 15 years or more. 

 

I've never seen a server refuse a PASV request, even if it supports EPSV as well.

 

It would need changes to the FTP client to prioritise EPSV over PASV, and I'm not likely to get to that for a few weeks.

 

Angus

 

Share this post


Link to post

I have implemented extended passive (and port) mode for the ICS client for IPv4 connections, however I'm not sure if it will fix the original poster's problem since it will only be used if the server FEAT command advertises availability, so it is unlikely to fail.  If it does fail, there is a new option that stops the EPSV and EPRT commands being used.  I asked for an FTP log that would have shown the FEAT command and failure response, but can not guess what is happening.

 

The ICS FTP server already supports EPSV for IPv4, unfortunately the developer that added it missed updating the FEAT command so it's not advertised, and few FTP clients will use it for IPv4, now fixed as well, will be in SVN once more testing is done.

 

Angus

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×