Skip to content
⌘ NSIS Forum Archive

http + ftp download plug-in

545 posts

Mæster#
Got a problem with InetLoad today.

I use it the following way inside a function:

InetLoad::load /PROXY $Proxy /USERNAME $ProxyUser /PASSWORD $ProxyPass /POPUP "$(Txt24)" "$R2" "$R1" /END
Seems to work only this way (only with /POPUP parameter). If I omitt the '/POPUP' parameter or if i try to use the '/BANNER' parameter the download fails with error 'Connection error'.

Any ideas?

Btw:
The delay problem seems to be not a plugin but a wininet issue. If I call the wininet.dll from inside a VB6 program the same delay occurs. The first initiation comes with 60s delay, the following not.

Regards,
Mæster.
Takhir#
Might be better to send 'problem' code 🙂

InetLoad::load /BANNER "Cameron Diaz" "Coming soon$\nto NSIS$\nwow"
"http://www.dreamgirlswallpaper.co.uk/pheonixnightskicksass/wallpaper/Cameron_Diaz/camerond04big.JPG" "$EXEDIR\cd.jpg"
works fine on my comp. Please note,
/BANNER CAPTION TEXT - 2 parameters, banner caption (1 string) and text near icon (up to 3 lines using $\n).
Mæster#edited
Takhir
Please note,
/BANNER CAPTION TEXT - 2 parameters, banner caption (1 string) and text near icon (up to 3 lines using $\n). [/B]
Oh thanks, forgot one parameter 🙄

Another question:
In the past i used the nsisdlSmooth-plugin (http://nsis.sourceforge.net/wiki/NSISdl_Smooth) to display an embedded nsis-download-dialog with progress bar in my Modern_UI_NSIS_Installer. I wish this could be done with the InetLoad plugin too.

BTW:
What means the PREFIX parameter following the /POPUP parameter? Seems currently not to be explained in the wiki.

Another hint:
Currently the InetLoad is easy to influence by the global IE settings. For instance, if the IE is set into the offline mode (FILE > Offline Mode) the download with the plugin will fail.
I dont know exactly if there are some wininet.dll flags to overcome these settings but if, it would be nice to implement them in the Inetload plugin. Its really hard to explain every installer user to configure the IE right before he/she is able to use the installer 😉

Best regards,
Mæster.
Takhir#
Thanks, Mæster.
1. I updated /POPUP description on the wiki page, PREFIX parameter sets left side of the popup dialog caption, for example
/popup "Win2007 setup"
gives something like this:
Win2007 setup - Downloading, 54%
Default "InetLoad plug-in" if /popup "" was used.
2. If both /popup and /banner were omitted, embedded NSISdl progress bar appears on the NSIS dialog (was re-tested right now). May be without smoothing 🙂
3. New version checks INTERNET_STATE_DISCONNECTED_BY_USER (offline) and sets IE state 'connected' this case. To initiate dial-up connection (if user is 'really' offline) you can use /RESUME option.
Guest#
I know it's been a couple months since the last post on this thread, but would it be possible to add ftp _upload_ to this plug-in?
Takhir#
I am overloaded with current programming, so big changes of code may be done next month only 🙁
May be you saw Margo' ftp plug-in, but (from Yatosho post) "unfortunately the plugin seems to crash occassionally without any further notice. however, when it crashes, it does so after being successfully executed." May be it is possible to find and update it's code. Finally I like the idea of good ftp plug-in. May be later I'll find code of my full-functional ftp backup client (with file versioninng and server' disk<->tape migration status support, written 6 years ago for ADIC, tested on up to 100,000 files in single backup queue 😉 ) and will do something, but I am not sure how soon this may happen. You can also use Windows ftp client with -s option in the command line (decorated with ExecDos on nsExec plugin), but it still not works in the 'passive' mode (many thanks to MS again 🙁 ). But compact and free ftp console client may be found in Net (I hope).
Yes, long, long explanations instead of working code 🙁
Guest#
Not a problem. I did see the other component, and the specific issue you pointed to. There's always another way.

Yes, microsoft is both a blessing and a curse. I am currently also figuring out a good (reliable) way to detect and install/remove/configure network adapters for my install application. Who knows, maybe I'll write a plug-in also! 🙂

Thank you for your amazingly quick response. I look forward to seeing future works from you.

David
Takhir#
InetClient

I added some code to InetLoad, but still have not time for good testing. After brief test: files download looks OK, ftp upload works in my office LAN and Inet. Change pwd and names in the included sample. http 'put' code also written, but not tested at all 🙁
Takhir#
testers wanted 🙂

Previous version worked 'almost' correct with http PUT, but new one also gets error code for this method (if any). http server first receives and stores uploaded file to tmp dir (progress bar appeares) and reports "method not allowed (405)" after this only if server is misconfigured 🙂 So big files uploading may looks confusing sometimes 🙂 I also had problems with http PUT if file size is > 500 kB, but this looks like my apache (or php script I used) limitation.
I still hope to get testing results from developers - after this I plan to replace InetLoad archive page 🙂
Guest#
Hi!
I've got a problem. I want to send data via a post connection. I know how. But I don't now how to send data via a post connection from variables >.<
My variable is a var in the scheme ${varname} and is declared with !define varname $R0 and the content comes from an InstallOptions-Script: ,ReadINIStr ${TEMP1} "register-ger.ini" "Field 1" "State"´
vbgunz#
${varname},${TEMP1} are not variables. These are defines created during compile time. A variable is declared like so.
Var varname
Var TEMP1
Those are variables...
Afrow UK#
Actually !define varname $R0 will work also, but unless you have !defined TEMP1 as a variable just like varname then you will get a compiler error.
${varname} -> $R0

-Stu
Takhir#
Following code should work. I used state=value for php. You can use MessageBox to check out intermediate results

Section
ReadINIStr $0 "register-ger.ini" "Field 1" "State"
#StrCpy $0 "test string" ; for test
InetLoad::load /post "state=$0" "http://www.mypostserver.com/post.php" "$EXEDIR\post_reply.htm"
Pop $0 # return value = exit code, "OK" means OK 🙂
MessageBox MB_OK "Post Status: $0"
SectionEnd
Server reply should appear in the post_reply.htm.
Guest#
Err, this is my code now:
Var var1
Var var2
Var var3
Var var4
;--------------------------------
; General Attributes

!define TEMP1 $R0
!define TEMP2 $R0
!define TEMP3 $R0
!define TEMP4 $R0

Name "VIRUS-Member"
OutFile "register-ger.exe"

ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
ReserveFile "register-ger.ini"

Page custom register-ger


!include "MUI.nsh"
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "German"

Section "register"

ReadINIStr $var1 "register-ger.ini" "Field 1" "State"
ReadINIStr $var2 "register-ger.ini" "Field 3" "State"
ReadINIStr $var3 "register-ger.ini" "Field 6" "State"
ReadINIStr $var4 "register-ger.ini" "Field 5" "State"

InetLoad::load /post "login=$var1&password=$var2&cracker=$var3&beschuetzer=$var4&create=1" "http://ollernick.ol.funpic.de/registerforgame.php" "success.html"
Pop $0 # return value = exit code, "OK" if OK
MessageBox MB_OK "Registrationsstatus: $0"
SectionEnd

Function .onInit

;Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "register-ger.ini"


FunctionEnd

LangString TEXT_IO_TITLE ${LANG_GERMAN} "Registration"
LangString TEXT_IO_SUBTITLE ${LANG_GERMAN} "Reggt euch doch ^^"

Function register-ger
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "register-ger.ini"
FunctionEnd

It wouldn't run 🙁
(If you see "Cracker" and "VIRUS", it's just a game
Takhir#
I had not your ini file, so I tested script with fixed parameters
    StrCpy $var1 aaaaa
StrCpy $var2 bbbbb
StrCpy $var3 ccccc
StrCpy $var4 ddddd

;MessageBox MB_OK "login=$var1&password=$var2&cracker=$var3&beschuetzer=$var4&create=1"
InetLoad::load /post "login=$var1&password=$var2&cracker=$var3&beschuetzer=$var4&create=1" "http://ollernick.ol.funpic.de/registerforgame.php" "success.html"
and found in the success.html aaaaabbbbbcccccddddd1
You can check vars using
;MessageBox MB_OK "login=$var1&password=$var2&cracker=$var3&beschuetzer=$var4&create=1"
and ini file content in this pause.
MinterWute#
Re: testers wanted 🙂

Originally posted by Takhir
Previous version worked 'almost' correct with http PUT, but new one also gets error code for this method (if any). http server first receives and stores uploaded file to tmp dir (progress bar appeares) and reports "method not allowed (405)" after this only if server is misconfigured 🙂 So big files uploading may looks confusing sometimes 🙂 I also had problems with http PUT if file size is > 500 kB, but this looks like my apache (or php script I used) limitation.
I still hope to get testing results from developers - after this I plan to replace InetLoad archive page 🙂
Thanks for this update, I've been using this for downloading updated files in my devkitPro installer ( http://www.devkitpro.org ) and also the MinGW ( http://www.mingw.org ) installer I've been working on. This one has proved to be much better at connecting to the sourceforge sites on Windows XP sp2 than the previous version.

I do have one question. One user has problems with a proxy that requires him to log in. Are there any environment variables that can be set if the plugin isn't picking up the IE proxy settings? Being honest I'm not 100% sure if IE holds these settings for him, the problem report was fairly minimal.



Thanks for all your hard work
Dave
Takhir#edited
Good question. Both InetLoad/inetc have the same parameters set including [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD] (INTERNET_OPEN_TYPE_PROXY, INTERNET_OPTION_PROXY_USERNAME and INTERNET_OPTION_PROXY_PASSWORD). But for local proxies user-specific values required (if parameters not come with IE pre-sets). Currently I have not information about env. vars for local proxy settings, but on the proxy error plug-in should return "Proxy Error (407)" string in the Pop, this case we can ask user - display custom dialog for login/password. The simplest way I see is plug-in with auth request for 'in section' usage (I wrote this 5 minutes ago, so test it first 😉 ), this may be universal approach - not for InetLoad/inetc only. Finally, if you see specific proxy error in InetLoad exit, ask user and call InetLoad again.
Edited And you should handle installer' silent mode in script by skipping dialog in the silent mode.
Takhir#
I updated InetClient plug-in to use WinInet internal authentication dialog for server and proxy auth. request. Tonight I'll add the same changes to InetLoad.
MinterWute#
I'm having an issue with the inetc plugin crashing when using resume and the user clicks cancel on the retry/cancel messagebox. The following script shows the problem.

;--------------------------------
; General Attributes

Name "inetc test"
OutFile "inetctest.exe"
ShowInstDetails show

;--------------------------------
;Interface Settings

!include "MUI.nsh"
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy

inetc::get /resume "" "http://www.bogus.com/bogus.txt" "$EXEDIR\mirrorlist.html" /END
pop $0
detailprint $0

SectionEnd


If I use this code instead then it works as expected.

inetc::get /popup "" /resume "" "http://www.bogus.com/bogus.txt" "$EXEDIR\mirrorlist.html" /END
Takhir#
Could not reproduce this on my XP Pro SP2 + IE 6.0. Not crashes, DetailPrint:
SendRequest Error
Completed
I'll inspect code later today, but may be you can give me more details about your test (system configuration, etc.)?
MinterWute#
Win2k Pro SP4, IE 6.0.2800.1106, NSIS 2.16, AMD Sempron 2600

The annoying thing is if I set a breakpoint at the pushstring in the get function and step with the VS debugger then I don't get a crash either :/ Is it perhaps some sort of timing issue?
Takhir#
please test

I improved few suspicious places, but I still cannot reproduce am not sure in the new version, please test.
shaunb#
Might be a silly question,

If I point this at a url of a webscript such as CF in silent mode, will it execute the script silently? e.g if I pointed it to the url



it'll just execute the script contents without bringing up a browser window? hmm sounds like it would .. I'll have to give it a try.

thanks
MinterWute#
Re: please test

Originally posted by Takhir
I improved few suspicious places, but I still cannot reproduce am not sure in the new version, please test.
Sorry, still crashes, is there anything I can do with a debugger that might help you?

It looks like it's some sort of stack issue - when it crashes it seems to be executing somewhere random.
Takhir#
I have sent personal message with inetc debug build and comments. Crash still not repeats even on W2K with you configuration. Strange thing - plug-in reports about "Server Error" on W2K and "SendRequest Error" on WinXP.
Takhir#
Inetc update: new /CAPTION TEXT parameter (zeeh3 request). Mainly for RESUME message box header in the "old style" output, i.e. if caption not defined and plug-in uses default and english "InetClient plug-in". As a result /POPUP and /SILENT now go without (caption) parameter, and /BANNER has single one (window body text). This not touchs InetLoad yet, may be later, after some test period, so please read wiki page when download new version. Also may be in the SILENT mode plug-in should not display message above progress bar, but for now I left it as it is.
polygonansigt#
I am trying to download a list of files, but something fails, i am probably doing something that is not possible :-)

StrCpy $test '"http://testserver.com/files/tmp.exe" "$TEMP\tmp.exe"'

InetLoad::load /popup "test load" $test

This is producing nothing, am i doing something real odd, or is this just impossible. My goal is to be able to build a "list" of files to be downloaded.

StrCpy $test '"http://testserver.com/files/tmp.exe" "$TEMP\tmp.exe" "http://testserver.com/files/tmp2.exe" "$TEMP\tmp2.exe"' :-)

Regards
Takhir#
Multiple download sample was tested many times. In your script NSIS might put $test as a single string to stack. Please test "long" command line first (without strcpy) and check exit code.