hURL large options on MorphOS

Discuss about plugins that don't have a dedicated forum
Post Reply
User avatar
jPV
Posts: 600
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

hURL large options on MorphOS

Post by jPV »

"Large" options don't seem to work as expected in hURL on MorphOS. I haven't tried if they act the same way on other Amiga compatibles, but I tried that this doesn't seem to be an issue on Windows.

I haven't tried all those "large" options, but at least SetOpt_InFileSize_Large and SetOpt_Resume_From_Large don't work as I'd think they should work. And equivalent "non-large" options do work fine. It also bugs if I try to unset these options, even if I haven't set them before...

Here's a test script:

Code: Select all

@REQUIRE "hurl"

Function p_Write(data$)
    tr_data$ = tr_data$ .. data$
EndFunction

Function p_HeaderData(data$)
    ;DebugPrint(data$)
EndFunction

Function p_Transfer(resume, large, num)
    tr_data$ = Nil
    If resume
        If large Then e:SetOpt_Resume_From_Large(resume) Else e:SetOpt_Resume_From(resume)
    Else
        If large Then e:UnsetOpt_Resume_From_Large() Else e:UnsetOpt_Resume_From()
    EndIf
    e:SetOpt_URL(addr$ .. "/" .. file$)
    ExitOnError(False)
    e:Perform()
    err=GetLastError()
    ExitOnError(True)
    If err
        DebugPrint("Transfer", num, GetErrorName(err) .. " (" .. err .. ")")
    Else
        DebugPrint("Transfer", num, "OK")
        StringToFile(tr_data$, "htestfile" .. num)
    EndIf
EndFunction

prot$ = "ftp"
user$ = ""
pass$ = ""
port  = 21
addr$ = "main.aminet.net"
file$ = "README.BEFORE.UPLOAD"

e = hurl.Easy()
e:SetOpt_Default_Protocol(prot$)
If user$ Then e:SetOpt_Username(user$) Else e:UnsetOpt_Username()
If pass$ Then e:SetOpt_Password(pass$) Else e:UnsetOpt_Password()
If port>0 Then e:SetOpt_Port(port) Else e:UnsetOpt_Port()
e:SetOpt_WriteFunction(p_Write)
e:SetOpt_HeaderFunction(p_HeaderData)
e:SetOpt_NoProgress(1)

p_Transfer(10, False, 1) ; Works (trying to resume, not large)
p_Transfer(0, False, 2) ; Works (trying to get the whole file, not large)
p_Transfer(10, True, 3) ; Fails (trying to resume, large)
p_Transfer(0, True, 4) ; Fails (trying to get the whole file, large)

; This is another "Large" function I've tried, and it seems to bug too, for example, in this way:
DebugPrint("Trying InFileSize...")
e:SetOpt_InFileSize(-1) ; Works (-1 unsets this value)
e:SetOpt_InFileSize_Large(-1) ; Fails (A libcurl function was given a bad argument! (43))
DebugPrint("Done.") 
On MorphOS this outputs:
Transfer 1 OK
Transfer 2 OK
Transfer 3 Couldn't resume download! (36) (1642)
Transfer 4 Couldn't resume download! (36) (1642)
Trying InFileSize...
ftptest_large.hws:55: A libcurl function was given a bad argument! (43)

While on Windows it outputs:
Transfer 1 OK
Transfer 2 OK
Transfer 3 OK
Transfer 4 OK
Trying InFileSize...
Done.
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: hURL large options on MorphOS

Post by airsoftsoftwair »

Looks like a bug, will be fixed, thanks for reporting!
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: hURL large options on MorphOS

Post by airsoftsoftwair »

Code: Select all

- Fix: All options of type CURLOPT_XXX_LARGE (e.g. CURLOPT_RESUME_FROM_LARGE) were broken on pretty
  much all platforms except 64-bit Windows
Post Reply