Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to upload to correct FTPS folder if FTP site also exists
#1
Hello

I'm using Indy 10.6.0.516 on Delphi XE7.

I can get FTPS to upload to the correct folder using port 990 if there is no FTP site on the same IP. However, as soon as I set up an FTP site on port 21, then FTPS uploads now go to the FTP folder rather than the FTPS one.

Is it possible for Indy to work with FTPS when there are both FTP and FTPS sites on the same host? 

Here is my code:

Code:
               If IdFTP1.Connected then
                  IdFTP1.Disconnect;

               IdFTP1.Host:=FTP_HOST;
               IdFTP1.Port:=FTP_PORT; //990
               IdFTP1.Username:=FTP_USERID;
               IdFTP1.Password:=FTP_PASSWORD;
               IdFTP1.Passive:=True;

               IdSSLIOHandlerSocketOpenSSL1.Host:=FTP_HOST;
               IdSSLIOHandlerSocketOpenSSL1.Port:=FTP_PORT; //990
               IdSSLIOHandlerSocketOpenSSL1.DefaultPort:=FTP_PORT;

               IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method:=sslvSSLv23; 
               IdFTP1.IOHandler:=IdSSLIOHandlerSocketOpenSSL1;
               IdFTP1.UseTLS:=utUseExplicitTLS;

               IdFTP1.DataPortProtection:=ftpdpsPrivate;
               IdFTP1.Connect;
               IdFTP1.ChangeDir(FTP_FOLDER);

               IdFTP1.Put(zipSourceFile, zipDestinationFile);

Many thanks
Reply
#2
(05-10-2018, 03:37 PM)Vintner Wrote: I'm using Indy 10.6.0.516 on Delphi XE7.

That is a bit of a old version of Indy. The current version is 10.6.2.5457. You should consider upgrading.

(05-10-2018, 03:37 PM)Vintner Wrote: I can get FTPS to upload to the correct folder using port 990 if there is no FTP site on the same IP. However, as soon as I set up an FTP site on port 21, then FTPS uploads now go to the FTP folder rather than the FTPS one.

Do you mean that *two different sites* are being hosted on the same server IP? If so, and if the FTP server does not use the port number to distinguish between them, then the FTP server needs to support the HOST command, which allows a client to specify which site they want to work with. TIdFTP has public UseHOST and ServerHost properties, where UseHOST is True by default, and ServerHost defaults to using the Host property.

(05-10-2018, 03:37 PM)Vintner Wrote: Is it possible for Indy to work with FTPS when there are both FTP and FTPS sites on the same host? 

The only difference between FTP and FTPS is the port number, and use of SSL/TLS. Nothing else. That should not affect how the server manages hosting of *multiple sites*. A single *site* could have both FTP and FTPS endpoints, for instance.

(05-10-2018, 03:37 PM)Vintner Wrote:
Code:
IdSSLIOHandlerSocketOpenSSL1.Host:=FTP_HOST;
IdSSLIOHandlerSocketOpenSSL1.Port:=FTP_PORT; //990
IdSSLIOHandlerSocketOpenSSL1.DefaultPort:=FTP_PORT;

You don't need those assignments. Let Connect() handle them for you.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)