hURL 1.1 released

Official announcements from the Hollywood team
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: hURL 1.1 released

Post 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...
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: hURL 1.1 released

Post by airsoftsoftwair »

OS4 users please re-install hURL 1.1 as the build released on December 21st still had some debug output in it.
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: hURL 1.1 released

Post by xabierpayet »

Work perfect, thanks Andreas, and happy new year
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: hURL 1.1 released

Post 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
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: hURL 1.1 released

Post by airsoftsoftwair »

Thanks to Helmut Haake and Dominic Widmer, the German translation of the hURL 1.1 manual is now available here.
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: hURL 1.1 released

Post 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"
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: hURL 1.1 released

Post 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
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: hURL 1.1 released

Post 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
Post Reply