Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 4th November 2006, 00:49   #1
torpark
Senior Member
 
Join Date: Apr 2006
Posts: 113
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.

Quote:
;=== 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

Last edited by torpark; 4th November 2006 at 01:11.
torpark is offline   Reply With Quote
Old 4th November 2006, 08:58   #2
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,220
I received single-byte file both using InetLoad and Inetc ("0").
code:

;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
Takhir is offline   Reply With Quote
Old 4th November 2006, 10:45   #3
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,220
Also: in the silent mode you can use /popup option - InetLoad in all tests was stable both in /popup or /banner modes.
Takhir is offline   Reply With Quote
Old 4th November 2006, 12:45   #4
torpark
Senior Member
 
Join Date: Apr 2006
Posts: 113
Hmmm. Strange indeed.
torpark is offline   Reply With Quote
Old 4th November 2006, 13:54   #5
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,220
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).
Takhir is offline   Reply With Quote
Old 4th November 2006, 14:18   #6
torpark
Senior Member
 
Join Date: Apr 2006
Posts: 113
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".

code:
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:

code:
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"
torpark is offline   Reply With Quote
Old 4th November 2006, 15:48   #7
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,220
[/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'.
Takhir is offline   Reply With Quote
Old 4th November 2006, 16:02   #8
torpark
Senior Member
 
Join Date: Apr 2006
Posts: 113
Then why does it still not return "1" when:

code:

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



Quote:
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?:

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

torpark is offline   Reply With Quote
Old 4th November 2006, 17:13   #9
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,220
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
code:

plugin::func param1 param2

or
code:

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 is offline   Reply With Quote
Old 4th November 2006, 19:22   #10
torpark
Senior Member
 
Join Date: Apr 2006
Posts: 113
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:
code:

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:

code:


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.
torpark is offline   Reply With Quote
Old 4th November 2006, 19:28   #11
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Nice way of saying thank you, torpark.

You have an extra set of quotes there.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 4th November 2006, 20:02   #12
torpark
Senior Member
 
Join Date: Apr 2006
Posts: 113
Kichik, you are brilliant. That is exactly the right answer. No wonder I wasn't seeing the issue.
torpark is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump