Page 1 of 2

ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Fri Apr 01, 2016 5:01 pm
by Mariasole
Hi,
I always used the LC ftp commands to send files on the server.
I changed hosting and this no longer accept the "simple" ftp but the ftps. :shock:
I found out now by other forum post (http://forums.livecode.com/viewtopic.ph ... ps#p121545) that ftps is not yet supported by LC.
I read that I can use a workaround using CURL. :o
There is some saint who could help me figure out how to build a simple code that says:
LC with the help of CURL send to the server in ftps this file from here! (C:\UP\test.txt)
LC with the help of CURL download from the server this file in ftps in this folder! (C:\DOWN)
In fact I did not understand how to install curl, and how do I call this method from LC! :cry:
I use Windows 7....

Please help me
Mariasole
(=*.*=)

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Fri Apr 01, 2016 6:15 pm
by FourthWorld
The good news is that SFTP is a much safer choice than FTP, so your new host's requirement for SFTP is a good security-conscious move.

The bad news is, as you've found, that SFTP is not currently supported in LiveCode. It's in queue with the core dev team, and a community member is also working on an implementation that may be done sooner, but either way we don't have it in hand right now.

That said, as I outlined in that other thread there may be other options for solving the problem you're facing that may not require SFTP, depending on what you need to do.

Do you need to allow others to upload files to your site, or is this for your own personal file management?

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Fri Apr 01, 2016 6:54 pm
by Mariasole
Thanks Richard,
the ftp stack is only for my personal use!
The small ftp stack I had created it for my experiments with LC. For a year I am building a kind of library for my experiments (including my project on fairy tales) and this ftp stack that made uploads and downloads was one of them!
Now with the ftps I do not know what to do. This story freezes my experiments from the submarine! I can not automatically communicate with the server! No sonar no party! :evil:
How can I do? How do I use Curl? I think an example might serve to others who like me are real beginners ... :oops:
Thanks Richard for your kindness ...


Mariasole
(=*.*=)

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Fri Apr 01, 2016 7:09 pm
by FourthWorld
Curl may work, but I have no experience using it on Windows. I could recommend switching to Ubuntu, but that would be a silly fanboy move below even myself. :)

For general file management via SFTP have you used Filezilla? It's open source and feely available at:
https://filezilla-project.org/

Another option might be to make an HTTP-based solution using LC Server to handle the server side, but that's a lot of work and given what a great job Filezilla does it hardly seems worth the effort (unless of course you're looking for excuses to spend more time exploring LC Server).

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Fri Apr 01, 2016 7:34 pm
by Mariasole
Thanks Richard,
certainly I use Filezilla! :D But my problem is that I wish it were a stack of LC to post or to download the files to server. :?
Just as it happened so far with the "classic" ftp. :|

There is not a way to automate filezilla, it has no support for command line! :roll:
My OLD :cry: stack took the files from a folder and would send them to the server :!: .
He also had the ability :!: to download pages from the ftp server and I put them in a local folder.

In short, something stupid that now, being the FTPS server, I can no longer do.

Practically I should replace "libURLftpUploadFile, libURLDownloadToFile Command, libURLftpUpload Command" with the relative curl libraries (and commands)...

I read a lot on the LC forum about a possible workaround with curl (or wget) but there is no practical example that can help me ... :oops:

And yet, now that I'm looking around, this "new" ftps is widespread! :?

Thanks for everything...
Mariasole
(=*.*=)

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Fri Apr 01, 2016 8:06 pm
by Mariasole
I found this old post.... 8)
http://lists.runrev.com/pipermail/use-l ... 14763.html
Where can I find this stack? (RocketsCURL.rev) :?:
Maybe it could be a solution to the problem curl - ftps? :roll:

Thank you all
Mariasole
(=*.*=)

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Fri Apr 01, 2016 8:17 pm
by FourthWorld
Back in the day I had fun writing an FTP client in LiveCode (back then called "Revolution"):
http://www.mactech.com/articles/mactech ... index.html

These days I use Terminal for most server work, with rsync for moving a whole directory of files or scp for moving single files.

Unfortunately rsync, scp, wget, curl and other such things are included on OS X and Linux but not on Windows.

You could add Cygwin to your system to get a Linux-like shell if you're really into being geeky:
https://www.cygwin.com/

I tried finding a PowerShell solution that was scriptable from the command line, but it seems PS doesn't have SFTP built-in, and you'd need to use a third-party tool for that.

But as long as you have Filezilla installed, maybe its command-line options would work for you:
https://wiki.filezilla-project.org/Comm ... s_(Client)

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Fri Apr 01, 2016 8:19 pm
by FourthWorld
Mariasole wrote:I found this old post.... 8)
http://lists.runrev.com/pipermail/use-l ... 14763.html
Where can I find this stack? (RocketsCURL.rev) :?:
RevOnRockets was a server-side library. I don't believe it's still maintained, but if you were interested in creating an HTTP service on your server for uploading files this LiveCode Lesson may help:
http://lessons.livecode.com/m/4070/l/40 ... ode-server

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Tue Apr 05, 2016 12:02 pm
by Mariasole
Thank you very much Richard!
Thank you so much for your heroic patience...
Now I will try a solution, probably via shell.
Your article on MachTech I already knew it, and I used to build my small ftp client! :P

If you can... remember the great leaders of LC to develop quickly the ftps function. :wink:
In fact, it would be necessary that all the part related to the Internet (including the browser function) was improved and made more stable (like this unsolved bug... http://quality.livecode.com/show_bug.cgi?id=15736)... :mrgreen:


Thank you again!
Mariasole
(=*.*=)

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Tue Apr 05, 2016 12:28 pm
by AxWald
Hi,

you might have a look in the putty package.
PSCP or PSFTP might do what you want, via simple shell scripts.

Haven't tried myself, but should I need, I'd start here ;-)

Have fun!

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Mon Apr 11, 2016 5:36 pm
by Mariasole
AxWald wrote:Hi,

you might have a look in the putty package.
PSCP or PSFTP might do what you want, via simple shell scripts.

Haven't tried myself, but should I need, I'd start here ;-)

Have fun!

Thanks AxWald! :)
I tried to study Putty, but I think that in any case it is always best cURL, used via shell.
The biggest problem of cURL is that, at least in Windows, there is no way to carry on the files recursively. :shock:
There is in fact no way to transfer the entire contents of a folder directly on the server.
However I continue to do the tests. 8)
I still hope that the FTPS function is implemented early on LiveCode, why use cUrl et similia is really uncomfortable ... :cry:

Grazie ancora AxWald
Mariasole
(=*.*=)

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Mon Apr 11, 2016 6:40 pm
by mwieder
Even better than curl is httpie. It's cross-platform (disclaimer: I've never tried it under Windows, but it's supposed to work), the syntax is more intuitive and easier to use, and it works well from shell scripts.

https://github.com/jkbrzt/httpie

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Mon Apr 11, 2016 8:16 pm
by FourthWorld
Pardon me, this got long. But I know you don't mind reading even a long post if I at least try to be helpful, so others can ignore this long tome and this is for you (and part of a book I'll write later so I can repurpose the content):

LiveCode's Sweet Spot
LiveCode has enough features to make a good general-purpose word processor. But it's a lot of work to make one, and there are so many good ones (LibreOffice is awesome and completely free) that I don't know of anyone who's taken on that task.

But many of us have made specialized forms of word processors. For example, one of my ongoing projects is a WYSIWYG CMS for authoring and publishing medical reference content. It makes extensive use of LC's great field properties, and does some things easier than most word processors. But it wasn't trivial to build, and was cost-justified by virtue of addressing specialized needs no off-the-shelf software provides.

I believe this is where LiveCode shines most brightly: the tens of thousands of specialized ("vertical market") applications for which few if any existing software packages exist.

Like the old saying goes, "The only software worth writing is software that doesn't yet exist." Software is almost always cheaper to buy rather than build. And in many areas we find that the more general-purpose a software is the more free and open source options already exist to handle that scope of tasks well.

Just as LibreOffice provides a great office suite for free (in both senses, free of charge and with source code freely shared), Filezilla provides a great FTP/SFTP client. And there are others as well, many for every platform.

It can be fun and educational to take on a project as large as writing a general-purpose app of that scope, but it is a lot of work to do well and most of the time when I see young people ambitious enough to start something that big it almost never gets finished. A lot was learned along the way so it's not like the time was lost, but in the end there's a lot to be said for using existing proven apps for big-scope tasks.

If we had SFTP support this would be less difficult to do in LiveCode, but still not simple. Filezilla is pretty great, very feature-rich.

Use Cases for SFTP support
SFTP is slated for inclusion as part of the networking overhaul outlined among the Kickstarter goals. That implementation will depend on LiveCode Builder, so work can't begin until after v8.0 ships. We may also see something from the community for SFTP before then.

But I think one of the reasons it hasn't been a higher priority relative to other features in the queue is that it's not commonly needed, when we look at the types of things LiveCode is most commonly used for and where SFTP is most useful.

SFTP can play a role in many workflows, and given that HTTP is both more efficient and more secure for downloads, most of the work where SFTP is useful falls into one of three categories:

a) Handling uploads from people who are not administrators.

b) Handling uploads from people who are administrators.

c) Providing access to the server for general administrative tasks.

Given the broad scope of c), for those tasks I would recommend Filezilla or other off-the-shelf SFTP tool, since all the features needed are already in place and robustly well tested.

That leaves us focusing on uploads.

a) and b) seem similar because they both involve uploading files. But when we consider the scope of responsibilities for admins and non-admins, they're very different: giving full access to a server to someone who is not responsibile for maintaining it can lead to any number of issues from either willful or even accidental deletion, moving, or overriding of files.

For non-admins, rather than giving them access to everything on the server, it's more common to provide an HTTP-based API for uploading files and other content. This leaves the admin in control of what goes where, reducing errors and security exposure.

For admins, the more common approach to managing content on a server is through the command line. For example, rsync can upload an entire folder of files to a server far more efficiently than SFTP and every bit as securely, with additional options to maintain permissions, time stamps, and more. You may also find rsync's default recursiveness to be just the answer for what you'd been trying to do with cURL.

Mixing Shell Scripts with LiveCode
With LiveCode's shell function you can mix LiveCode and any number of shell commands to manage just about anything you can imagine, on your local machine or any remote host.

The key to working securely with remotes hosts is quite literally a key: SSH allows an option to share your local machine's public SSH key with a server, which is both more secure than passwords and much more convenient since shared keys no longer require a password to log in.

There's a tutorial for setting up shared SSH keys here in the forums:
http://forums.livecode.com/viewtopic.ph ... 3&p=106171

...and many online - this one's a favorite, very well written:
https://www.digitalocean.com/community/ ... sh-keys--2

The one challenge with writing shell scripts is platform dependence: historically, Windows users would use PowerShell while Unix (which includes Apple's OS X) and Linux use bash.

Thankfully, Microsoft recognized that they were bleeding devops talent by limiting shell choices to their proprietary PowerShell, and recently announced that Windows 10 now includes an option to use Ubuntu's bash environment natively within Windows.
http://www.zdnet.com/article/ubuntu-and ... indows-10/

For versions of Windows prior to 10, Cygwin provides a pretty good bash environment for Windows, which includes rsync and other command line tools popular in the bash world:
https://www.cygwin.com/

And when writing scripts that will only run on Windows, PowerShell is said to be pretty good. I don't use Windows enough to have much experience with PowerShell, but there are vast resources available.

Summary
- For general file management use by admins, off-the-shelf tools like Filezilla are a great fit.

- For non-admins to submit files or other content, an HTTP-based solution keeps things simple and safe.

- For specialized admin tasks, shared SSH keys open up a world of possibilities for crafting handy UIs in LiveCode to drive shell commands.

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Tue Apr 12, 2016 4:36 pm
by Mariasole
mwieder wrote:Even better than curl is httpie. It's cross-platform (disclaimer: I've never tried it under Windows, but it's supposed to work), the syntax is more intuitive and easier to use, and it works well from shell scripts.

https://github.com/jkbrzt/httpie

Thanks mwieder! :P
Now I see it and I will try to study it!

Mariasole
=^..^=

Re: ftp ---> ftps (panic!) ...help me please... (=*.*=)

Posted: Tue Apr 12, 2016 4:45 pm
by Mariasole
"The only software worth writing is software that doesn't yet exist."
Thanks Richard,
thank you very much for your long post which, as you know I also appreciate for its length and completeness.

I understand very well what you say and it is perfectly logical. The manufacturers of LiveCode, of course, have their agenda and a vision that, obviously, can not always coincide with us novice users.

I thought that the FTP component would evolve naturally in FTPS in future versions of LC, and that probably the component had been a little behind in the development!

But this is a naive view of a naive novice user! So I will study all the material you reported to me trying to make a profit!
I apologize to everyone for my trivial questions! :oops:


Thanks again
Mariasole
=^..^=