Archive: InetLoad Broken


InetLoad Broken
I'm having a problem with InetLoad.

And I'll accept help from Afrow to saivert. I am thinking intetload is busted when requesting https.

When it is inside my main program, it totally fails to write an outfile. When implemented here, it writes the outfile, but crashes, not getting to the messagebox afterwards. And before you ask, I've done it with /SILENT and I've done it with /END and I've done it with /RESUME and every combination thereof.

;=== Runtime Switches
CRCCheck On
WindowIcon Off
SilentInstall Silent
AutoCloseWindow True
SetCompressor /SOLID LZMA

Var AUTHURL
Var AUTHSTRING

Section "Main"

;md5dll::GetMD5File "$EXEDIR\Data\torrify\torrify.key"
md5dll::GetMD5File "torrify.key"
Pop $0
StrCpy $AUTHURL "https://www.metropipe.net/torrify/check.php?md5="
StrCpy $AUTHSTRING `"$AUTHURL$0"`
MessageBox MB_OK "$AUTHSTRING"
InetLoad::load "$AUTHSTRING" "$EXEDIR\outfile"
MessageBox MB_OK "Check for outfile"


SectionEnd

I received single-byte file both using InetLoad and Inetc ("0").


;InetLoad::load "$AUTHSTRING" "$EXEDIR\outfile"
Inetc::get "$AUTHSTRING" "$EXEDIR\outfile" /end
Pop $0
MessageBox MB_OK "Result $0, Check for outfile"

The problem is that both plug-ins work correct on all my comps and I cannot reproduce your problem, but independant testers reported that Inetc was stable in all modes. Below are http headers from inetc:
HTTP/1.1 200 OK
Date: Sat, 04 Nov 2006 12:02:36 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_ssl/2.8.9 OpenSSL/0.9.6g PHP/4.3.6
X-Powered-By: PHP/4.3.6
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

Also: in the silent mode you can use /popup option - InetLoad in all tests was stable both in /popup or /banner modes.


Hmmm. Strange indeed.


I added InetLoad internal switch to /popup for silent mode - no difference for user if installer and plug-in windowa are hidden. The same was done for Inetc earlier (it could not add NSISdl style child control to installer window if parent not exists).


Okay. Now I am sure the problem is with InetLoad.

It is not correctly understanding strings. If you directly substitute the value of $AUTHSTRING instead of using $AUTHSTRING, then it works and correclty returns "1" instead of "0".

Name "Testcon"
OutFile "Testcon.exe"

;=== Runtime Switches
CRCCheck On
WindowIcon Off
AutoCloseWindow True
SetCompressor /SOLID LZMA
SilentInstall Silent

Var AUTHURL
Var AUTHSTRING
Var AUTHMD5

Section "Main"
StrCpy $AUTHMD5 "df4d054a8ddcb5bcd1a59eebd6e12890"
StrCpy $AUTHURL "https://www.metropipe.net/torrify/check.php?md5="
StrCpy $AUTHSTRING `"$AUTHURL$AUTHMD5"`
MessageBox MB_OK "Authorization String = $AUTHSTRING"
InetLoad::load /SILENT /RESUME "$AUTHSTRING" "$EXEDIR\auth.chk" /END
SectionEnd


Which will return a "0"

versus:

Name "Testcon"
OutFile "Testcon.exe"

;=== Runtime Switches
CRCCheck On
WindowIcon Off
AutoCloseWindow True
SetCompressor /SOLID LZMA
SilentInstall Silent


Section "Main"
InetLoad::load /SILENT /RESUME "https://www.metropipe.net/torrify/check.php?md5=df4d054a8ddcb5bcd1a59eebd6e12890" "$EXEDIR\auth.chk" /END
SectionEnd


which will return "1"

[/RESUME RETRY_QUESTION]
If you want use default resume question value, please set
/resume ""
In your command line plug-in threats URL as resume text and cannot get correct URL, so script above could not work (with last versions). Plug-in exit code (see included samples) may help to understand what really happened. Using Pop after plug-in call also helps to keep stack clean - otherwise next plug-in call may get garbage as parameters.
InetLoad not interprets parameters, it downloads basing on the strings coming from stack only - NSIS pushes command line parameters there, so this is not InetLoad problem. You can use Push instructions instead of command lin, beginning with last parameter. This should work, but you can use Push+Pop and compare strings to check stack correctness.
And for silent mode resume always internally switched to 'false'.


Then why does it still not return "1" when:


Name "Testcon"
OutFile "Testcon.exe"

;=== Runtime Switches
CRCCheck On
WindowIcon Off
AutoCloseWindow True
SetCompressor /SOLID LZMA
SilentInstall Silent

Var AUTHURL
Var AUTHSTRING
Var AUTHMD5

Section "Main"
StrCpy $AUTHMD5 "df4d054a8ddcb5bcd1a59eebd6e12890"
StrCpy $AUTHURL "https://www.metropipe.net/torrify/check.php?md5="
StrCpy $AUTHSTRING `"$AUTHURL$AUTHMD5"`
MessageBox MB_OK "Authorization String = $AUTHSTRING"
InetLoad::load "$AUTHSTRING" "$EXEDIR\auth.chk" /END
SectionEnd


InetLoad not interprets parameters, it downloads basing on the strings coming from stack only
If that is true, why are the examples in the Plugins wiki using parameters?:

InetLoad::load "http://dl.zvuki*****6306/mp3/12.mp3" "$EXEDIR\12.mp3" \
"ftp://dl.zvuki*****6306/mp3/11.mp3" "$EXEDIR\11.mp3"
Pop $0

How it works ;)
NSIS takes parameters beginning the last one and pushes them to installer's stack - this way it transfers parameters to plug-in. No difference for plug-in what form of stack filling was used


plugin::func param1 param2
or

Push param2
Push param1
plugin::func

first form is shorter and so used more often, but second form shows what really happens. I used short form for samples.
Just return $_REQUEST['md5'] string from check.php and compare with string sent ;)

Takhir, your answer is absolute bullshit. It works using the characters, it stops working when using a variable. If you just don't know the answer admit that Inetload is broken or that nsis isn't properly passing variables.

Once again: This one works, and the next code example does not. This has zero to do with parameters or the stack or anything else. It is a direct substitution that is not syntax related.

The one that works:


Name "Testcon"
OutFile "Testcon_push.exe"

;=== Runtime Switches
CRCCheck On
WindowIcon Off
AutoCloseWindow True
SetCompressor /SOLID LZMA
SilentInstall Silent

Section "Main"
Pop $0
Push "/END"
Push "$EXEDIR\output.txt"
Push "https://www.metropipe.net/torrify/check.php?md5=df4d054a8ddcb5bcd1a59eebd6e12890"
InetLoad::load
SectionEnd


And now the one that doesn't, which is a direct substitution using a string instead of text:



Name "Testcon"
OutFile "Testcon_push.exe"

;=== Runtime Switches
CRCCheck On
WindowIcon Off
AutoCloseWindow True
SetCompressor /SOLID LZMA
SilentInstall Silent

Var AUTHURL
Var AUTHSTRING
Var AUTHMD5

Section "Main"
StrCpy $AUTHMD5 "df4d054a8ddcb5bcd1a59eebd6e12890"
StrCpy $AUTHURL "https://www.metropipe.net/torrify/check.php?md5="
StrCpy $AUTHSTRING `"$AUTHURL$AUTHMD5"`
Pop $0
Push "/END"
Push "$EXEDIR\output.txt"
Push "$AUTHSTRING"
InetLoad::load
SectionEnd


As you notice, the first code produces "1", and the second code produces "0". 1, from the server, means that the website address exists, and 0 means it does not. So that direct substitution which is entirely equivalent, should result in a "1" instead of a "0". There is no reason that the first way should succeed and the second way shouldn't, if InetLoad or NSIS didn't have errors. I seriously am waiting for an explanation about how these are both just fine and now it is some other issue.

Nice way of saying thank you, torpark.

You have an extra set of quotes there.


Kichik, you are brilliant. That is exactly the right answer. No wonder I wasn't seeing the issue.