libURL -- FTP over SSH

Sannyasin Sivakatirswami katir at hindu.org
Sun Oct 3 23:56:49 EDT 2004


Andre: Aloha from Hawaii:

"see some code"

Not sure if  you meant Dave Cragg's libURL core code or my scripts... I  
think you can hack libURL former from within the IDE itself... at least  
I could two years ago... haven't dug that deep into the IDE for a  
while. but I would be surprised if you can do the encryption thing over  
port 22... ;-)

but, the trancript from interarchy's FTP over SSH looks like any  
passive connection would...

Below is a typical script... it uploads a set of photos for a daily web  
page and and index file for www.gurudeva.org. I have mode set to ACTIVE  
in this one. but that's going to fail for sure to our new OLM   
server...  (really fabulous managed server services there btw... I'm  
really happy with them, support is great..)

pretty simple.. never more than about 43 photos, max,  it's a small  
daily upload, but I still get errors, typically I'll see the last 150  
entry in the log:

150 Opening BINARY mode data connection for  
/export/vhost/org/g/gurudeva/www/public_html/01-guestsVisiting-10 
-1.jpg.

then... hangs.. and then "Error: Socket time out" from libURL...

I'd would rather not try to set up the server to do the job...

Thanks
Sivakatirswami

===========

global tUrlStem, tFiles, tSourcePath,tMonth,tYear,tDateString,  
gArchiveFolder

on mouseUp
    if gArchivefolder is empty then
     answer folder "Choose your TAKA archive folder"
     if it is empty then exit mouseup
     put it & "/" into gArchiveFolder
   end if


   setDateItems
   ## returns the date String e.g. "December_09_2002"

   ### set log in variables
   put "www.REMOTESERVER.com" into tHost
   put "USER" into tUser
   put "PASSWORD" into tPass
   ## create a path string for the new directory for today

   put "/gig/htoday/public_html/today/Archives/Past/" into tPath
   put tPath & tYear &"/" & tMonth& "/"  & tDateString &"/" into tFolder

   ######## send the files

   ## get a local file list with paths
   if gArchivefolder is  empty then
     answer folder "Find directory for upload to San Diego"
     if it is not empty then
       put it into gArchivefolder
     else
       exit mouseUp
     end if
   end if

       put gArchiveFolder into tSourcePath
       set the directory to tSourcePath
       put the files into tFiles

# skip dot files...
       if char 1 of line 1 of tFiles ="." then delete line 1 of tFiles

## skip temp file...
       delete line (lineoffset ("nakshatra",tFiles)) of tFiles

     put "ftp://user:password@" & tHost & tFolder into tUrlStem
       put the long id of field "ftp log" into tField
       libUrlSetLogField tField
         LibUrlSetFTPMode "Active"

       set the socketTimeoutInterval  to 20000
       uploadNext

end MouseUp

on uploadNext
   if line 1 of tFiles is not empty then
     put tUrlStem & (line 1 of tFiles) into tUrl
     put tSourcePath &  (line 1 of tFiles) into tFilePath
      put "loading... " & tURL & tFilePath into fld "Watch"
     libUrlFtpUploadFile tFilePath, tUrl, "loadDone"
   else
      put  "Upload Complete!"  into fld "watch"
     wait 20 ticks
## does the same thing to a different server in Honolulu:
     send mouseup to btn "FTP to Mahiai"
   end if
end uploadNext

on loadDone pUrl, pStatus
   if pStatus is not "uploaded" then
     get libUrlErrorData (pUrl)
     answer  it
     put line 1 of tFiles & cr & it & cr & "--------" & cr into tFailures
     delete line 1 of tFiles
     put "Did not upload:" & cr & tFailures
     unload url pUrl
   else
     put (pUrl & " was uploaded successfully.") into fld "watch"
     unload url pUrl
     delete line 1 of tFiles
         wait 30 ticks

      uploadNext
   end if

end loadDone


On Oct 3, 2004, at 5:00 PM, Andre Garzia wrote:

>
> Oh boy.... I don't know if it can be done easily, if you need I can  
> send you my FTPd code, the FTP  Server side is almost implemented,  
> there need to fix CWD and to implement STOR, but it might help to see  
> some libURL code that tries to ftp things.
>
> Also, what about doing the other way, set up the ftp server on your  
> side and allow them to connect?
>
> cheers
> andre
>
>
>
> On Oct 3, 2004, at 11:44 PM, Sannyasin Sivakatirswami wrote:
>
>> Can libURL do FTP over SSH?
>>
>>  ... where the control connection is encrypted on port 22, but the  
>> data connection is unencrypted and  a new random port issued by the  
>> remote server for a new connection to open  a per file basis,... i.e.  
>> appears to handshake like PASSIVE mode...
>>
>> I had a terrible time with regular FTP to our new dedicated server at  
>> the OLM Data center in Connecticutt. They turned off ACTIVE for the  
>> whole center because of attacks, but regular  FTP on port 21/PASSIVE  
>> kept failing... the old problem of two firewalls unable to sort it  
>> out... I couldn't get a pipe to stand up for more then 10 files... 2  
>> minutes...
>>
>> When I switched to SSH over FTP... it was solid as a rock -- in fact  
>> I've been uploading data now for 21 hours with Interarchy, from  
>> Hawaii to Connecticutt.. and there hasn't been a single broken pipe  
>> in all that time... 22,000 files-3 gigs of data uploaded and 2.5 gigs  
>> more to go...
>>
>> Anyway I need to point all my Rev web generator scripts to the new  
>> server and hope that libURL will be able to do as good a job as  
>> interArchy, ideally it could do FTP over SSH but don't see any SSH  
>> entry in the docs. If not, I may be forced to resort to issuing  
>> applescripts  commands to tell interarchy to do the job... not a  
>> pleasant prospect, when single line commands are there in Rev.
>>
>> Sannyasin Sivakatirswami
>> Himalayan Academy Publications
>> at Kauai's Hindu Monastery
>> katir at hindu.org
>>
>> www.HimalayanAcademy.com,
>> www.HinduismToday.com
>> www.Gurudeva.org
>> www.Hindu.org
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
> -- 
> Andre Alves Garzia ð 2004 ð BRAZIL
> http://studio.soapdog.org
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list