Logic Machine Forum
FTPS trouble with ftp.put - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: FTPS trouble with ftp.put (/showthread.php?tid=5321)



FTPS trouble with ftp.put - ferrim - 24.03.2024

Dear all,
on the advice of the Italian distributor I open this new thread on a topic already partially covered.

I have two LM5 Lite (fw 20240219) on my desktop connected to the same switch, on the first LM I run the client code (scripting/scheduled) you see below and I use the second as an FTP server.

With the FTP server without encryption mode, I remove the two parameters secure = true and datasecure = true from the client code and I can transfer a 2 MB .csv file without problems from the first LM to the other.

If I enable Require Encryption FTPS mode on the server and re-enable the two parameters secure/datasecure on the first LM, I can only transfer small size file (< 8 KB) otherwise I receive a 426 Failure reading network stream error and the file is truncated on the server.

If I use a generic FTPS client like Filezilla or WinSCP I can transfer files of any size on the second LM without error.

Over the weekend I tried to understand more but all I got was a headache...

Code:
ftp = require('socket.ftp')
ltn12 = require('ltn12')
host = 'xxx.xxx.xxx.xxx'
user = 'xxx'
pass = 'xxx'
data = io.readfile('/data/ftp/testfile.txt') 
path = ('/testfile.txt')
res, err = ftp.put({
  host = host,
  user = user,
  password = pass,
  argument = path,
  type = "a",
  secure = true, -- Remove with FTP Server without encryption
  datasecure = true, -- Remove with FTP Server without encryption
  source = ltn12.source.string(data)
})
 
if not res then
  alert('FTP upload error: %s', tostring(err))
end



RE: FTPS trouble with ftp.put - admin - 25.03.2024

Install updated package through System config > System > Packages > Add package and see if it helps:

https://dl.openrb.com/pkg/luasocket_2.0.2-20240325_imx6.ipk
https://dl.openrb.com/pkg/luasocket_2.0.2-20240325_imx6.sig


RE: FTPS trouble with ftp.put - ferrim - 25.03.2024

(25.03.2024, 10:57)admin Wrote: Install updated package through System config > System > Packages > Add package and see if it helps:

https://dl.openrb.com/pkg/luasocket_2.0.2-20240325_imx6.ipk
https://dl.openrb.com/pkg/luasocket_2.0.2-20240325_imx6.sig

From the first tests it seems to work well, thank you for solving this problem so quickly!
BR
Marcello