RWSN#63637 ftp code weer gewoon via SLNKDWF in plaats van Chilkat. Zelf gebruiken we het ondertussen niet meer

svn path=/Website/branches/v2020.1/; revision=47938
This commit is contained in:
Jos Groot Lipman
2020-08-26 15:33:43 +00:00
parent 0bd267e90f
commit 1f87bee709
2 changed files with 19 additions and 44 deletions

View File

@@ -135,58 +135,38 @@ function ConnectorCls()
{ // voorbeeld: "ftp://example.com/folder/"
this.ConnectionType = CONNECTION_FTP;
Log2File(2, "Creating ftp connector");
//var about = new ActiveXObject("SLNKDWF.About");
//Log2File(2, "Ge<47>nstalleerde SLNKDWF Versie: " + about.VersionString);
//Log2File(2, about.All);
var about = new ActiveXObject("SLNKDWF.About");
Log2File(2, "Ge<47>nstalleerde SLNKDWF Versie: " + about.VersionString);
Log2File(2, about.All);
//
var glob = new ActiveXObject("Chilkat_9_5_0.Global")
var success = glob.UnlockBundle("Anything for 30-day trial")
if (success != 1)
throw { description: glob.LastErrorText };
this.ftpconnection = new ActiveXObject("Chilkat_9_5_0.Ftp2");
this.ftpconnection = new ActiveXObject("SLNKDWF.FTP");
this.ftpconnection.Hostname = URLParts.host;
if (p_bedrijfadres.username) this.ftpconnection.Username = p_bedrijfadres.username;
if (p_bedrijfadres.password) this.ftpconnection.Password = p_bedrijfadres.password;
this.ftpconnection.Username = p_bedrijfadres.username;
this.ftpconnection.Password = p_bedrijfadres.password;
this.ftpconnection.Port = URLParts.port || 21;
//this.ftpconnection.Passive = 1; //passive is de default en dat willen ze allemaal?
//if (S("puo_useproxy"))
{
this.ftpconnection.ProxyHostname = "80.250.129.1" //S("puo_proxyserveripaddress");
this.ftpconnection.ProxyPort = 21;
this.ftpconnection.ProxyUsername = "dummy@example.com";
//pMethod = ftp.DetermineProxyMethod(); // altijd -1/ failure
//WScript.Echo( pMethod );
this.ftpconnection.ProxyMethod = 2; // https://www.chilkatsoft.com/p/p_87.asp
}
//this.Subfolder = URLParts.directory;
//this.ftpconnection.Flags = S("puo_connectionflag")||0;
this.ftpconnection.Proxyname = (S("puo_useproxy") ? S("puo_proxyserveripaddress") : "");
this.Subfolder = URLParts.directory;
this.ftpconnection.Flags = S("puo_connectionflag")||0;
//
Log2File(2, "protocol: ftp");
//Log2File(2, "FTPServer: " + this.ftpconnection.Hostname);
//Log2File(2, "FTPPort: " + this.ftpconnection.Port);
//Log2File(2, "FTPProxy: " + this.ftpconnection.Proxyname);
//Log2File(2, "FTPDir: " + this.Subfolder);
//Log2File(2, "Flags: " + this.ftpconnection.Flags);
Log2File(2, "FTPServer: " + this.ftpconnection.Hostname);
Log2File(2, "FTPPort: " + this.ftpconnection.Port);
Log2File(2, "FTPProxy: " + this.ftpconnection.Proxyname);
Log2File(2, "FTPDir: " + this.Subfolder);
Log2File(2, "Flags: " + this.ftpconnection.Flags);
//
if (S("puo_lcl_friendly_ftp"))
this.friendlyurl = S("puo_lcl_friendly_ftp").format(URLParts.host, URLParts.directory, URLParts.port);
try
{
// Probeer nu de FTP verbinding tot stand te brengen.
var success = this.ftpconnection.Connect();
if (success != 1)
throw { description: this.ftpconnection.LastErrorText };
this.ftpconnection.Open();
// Change FTP dir
if (URLParts.directory)
{
try
{
var success = this.ftpconnection.ChangeRemoteDir(URLParts.directory);
if (success != 1)
throw { description: this.ftpconnection.LastErrorText };
this.ftpconnection.SetCurrentDir(URLParts.directory);
this.Connected = true;
}
catch(err)
@@ -198,7 +178,6 @@ function ConnectorCls()
{
this.Connected = true;
}
Log2File(0, "Connected to: " + this.ftpconnection.GetCurrentRemoteDir());
}
catch(err)
{
@@ -304,7 +283,7 @@ function ConnectorCls()
try
{
Log2File(2, "Disconnect");
success = this.ftpconnection.Disconnect(); // Let op: effectief sluit deze alleen de SLNKDWF.FTP verbinding.
this.ftpconnection.Close(); // Let op: effectief sluit deze alleen de SLNKDWF.FTP verbinding.
this.Connected = false;
}
catch(err)

View File

@@ -20,18 +20,14 @@ function sendFTP(p_connect, p_file, p_data, p_path)
{
objFile = objFso.GetFile(p_path);
Log2File(1, "Transfer file: " + p_file + " (size: " + objFile.Size + ")");
var success = p_connect.ftpconnection.PutFile(p_path, p_file); // Hiermee kunnen ook binary bestanden gekopieerd worden.
if (success != 1)
throw { description: p_connect.ftpconnection.LastErrorText };
p_connect.ftpconnection.PutFile(p_file, p_path); // Hiermee kunnen ook binary bestanden gekopieerd worden.
}
else
{ // Forceer p_data altijd naar utf-8
var tempfile = "../../../temp/puo_" + objFso.GetTempName();
p_data.SaveToFile(tempfile);
Log2File(1, "Transfer data as file: " + p_file + " (size: " + p_data.Size + ")");
var success = p_connect.ftpconnection.PutFile(tempfile, p_file); // Hiermee kunnen ook binary bestanden gekopieerd worden.
if (success != 1)
throw { description: p_connect.ftpconnection.LastErrorText };
p_connect.ftpconnection.PutFile(p_file, tempfile); // Hiermee kunnen ook binary bestanden gekopieerd worden.
if (S("puo_loglevel") < 4)
objFso.DeleteFile(tempfile);
// schrijft geen utf-8