Page 2 of 2

Re: hURL 1.1 released

Posted: Wed Dec 30, 2020 12:36 am
by airsoftsoftwair
Try this code for FTP upload using hURL:

Code: Select all

@REQUIRE "hurl"

Function p_ReadFunc(len)
	
	If rlen + len > flen Then len = flen - rlen
	
	If len > 0
		rlen = rlen + len
		Return(ReadBytes(1, len))
	Else
		Return("")
	EndIf
			
EndFunction	

usr$ = StringRequest("", "User?")
pwd$ = StringRequest("", "Password?")
f$ = FileRequest("Select file")

OpenFile(1, f$)
flen = FileLength(1)

e = hurl.easy({url = "ftp://myserver.com/destdir/" .. FilePart(f$), username = usr$, password = pwd$, readfunction = p_ReadFunc, upload = 1, infilesize = flen})
e:perform()
e:close()
CloseFile(1)
This does the job here...

Re: hURL 1.1 released

Posted: Wed Dec 30, 2020 10:50 pm
by airsoftsoftwair
OS4 users please re-install hURL 1.1 as the build released on December 21st still had some debug output in it.

Re: hURL 1.1 released

Posted: Thu Dec 31, 2020 3:34 pm
by xabierpayet
Work perfect, thanks Andreas, and happy new year

Re: hURL 1.1 released

Posted: Fri Jan 22, 2021 9:49 pm
by airsoftsoftwair
This has been fixed in Hollywood now as well. Starting with the next Hollywood update, it should also work by just using UploadFile().

Code: Select all

- New [SDK]: Added new tags for HWPLUG_CAPS_NETWORKADAPTER/OpenConnection(); these tags make it possible
  for OpenConnection() to signal that it wants to take over protocol interaction completely; this makes it
  possible to write plugins which add support for custom protocols to DownloadFile() and UploadFile() so
  that they are no longer limited to HTTP and FTP

Re: hURL 1.1 released

Posted: Tue Feb 16, 2021 11:38 pm
by airsoftsoftwair
Thanks to Helmut Haake and Dominic Widmer, the German translation of the hURL 1.1 manual is now available here.

Re: hURL 1.1 released

Posted: Wed Mar 17, 2021 4:11 pm
by amyren
Does hURL have a problem with ftp and downloadfile?

Code: Select all

serverconfig$ = "ftp://myusername:mypass@ftp.mysite.info/globalhs.data"
DownloadFile(serverconfig$, {File = globalHS$, Adapter = "hurl"})
This will give me the error message: The following network error occurred:
connection refused
Removing Adapter = "hurl" and it works

serverconfig$ is read from an external file, so the user can edit and use their own server.
When serverconfig$ is set to https://something.com/globalhs.data it will work with Adapter = "hURL"

Re: hURL 1.1 released

Posted: Thu Mar 18, 2021 12:31 pm
by amyren
To avoid the issue I made this workaround to detect if hURL is needed or not.

Code: Select all

If FindStr(serverconfig$, "tps:") > 0 And FindStr(serverconfig$, "tps:") < 3 Then hurlreq = True

Re: hURL 1.1 released

Posted: Thu Mar 18, 2021 6:43 pm
by airsoftsoftwair
amyren wrote: Wed Mar 17, 2021 4:11 pm Does hURL have a problem with ftp and downloadfile?
Yes, see above :) It's fixed by viewtopic.php?p=16471#p16471