Archive: http + ftp download plug-in


http + ftp download plug-in
Attached plugin supports http and ftp downloads. Included script sample downloads 2 mp3 files (one for each protocol). I wrote it fast (from code pieces I had :) ) and used the simplest InternetOpenUrl() way to do this, so functionality is limited (ftp restart may not work, WM_NOTIFY_OUTER_NEXT skipped, english only, ...). And dialog design is ugly :( (any ideas?)
But finally http works good (many thanks to MS guys), I even tested download restart after disconnect (but this require more tests). Re-get defaults: disabled, pause 5 sec.


wording improved :)


Empty file size fields looks lonely :) on ftp download, so I added ftp file size request. If ftp server not allows directory browsing (like dl.zvuki.ru does), InternetOpenUrl() fails and new connect (and time) required for file download, so I reworked this to common ftp session with single InternetConnect(). Script sample requests big (14 MB) file from MS ftp site (file size available), so better replace this with your own link.


Can this plugin download silent and with process?

can can shellexecute it.

I am new in NSIS can you include a simple example?

Thanks...


This may be interesting - start download at the very beginning and run 2 processes, installation itself and file download (or I misunderstood something?).
It is possible to run dll as a process using rundll(32).dll, only new plug-in dll entry point required for this (short function). Programming side of problem is simple, but I'd like to understand first how to make working ftp reget using FtpCommand() call (size and restart commands). After this - may be.
If you want hide plug-in dialog in it's current state - comment ShowWindow() line in source code and rebuild project.


What are the minimum requirements for this plug-in? It takes proxy settings from IE, right? I have been meaning to write a new NSISdl based on IE's downloading engine to solve all of those proxy problems. If you're already at it, how about you add an option to download more than one file in a row, I review the code, and we slap a NSISdl2 tag on it?


yea :)
I am having a lot of problems with corporate networks using proxy settings
a new NSISdl would be fantastic
g


Originally posted by kichik
What are the minimum requirements for this plug-in? It takes proxy settings from IE, right?
I also had a full range of chunked HTTP + proxy problems in one of my apps when used socket based http client :( . What is good for net learning, sometimes is bad for business :) But few years ago Win95 compatibility requirement was taken off (in later Win versions IE and Inet API is always on place), and I could re-work it to Inet API.
Minimum requirements... HTTP without problems. I also thought about re-get functionality (for installers trying to download dotnetfx via dial-up) and about ftp, but it looks like both idias are not claimed by developers :)
OK, simple and stable http download without re-get, but more then one file. I thought about local path definition only (instead of every local file parameter), but this limits functionality with static server files only (not cgi/php), so parameters line is following:

InetLoad::load URL1 local_file1 [URL2 local_file2 [...]]

ftp works, but it not requests file size - InternetOpenUrl() functionality is limited.

to Kichik
I also thought a little about extended requirements and result attached, better ftp and simple (hidden) re-get. But more code - more bugs :) You can use any version.


I fixed one bug in last (extended) version and improved download status displaying.


is inetload working with proxy networks...or is that a future thing ?
g


Good question. Plug-in works in my proxy tests, but this is 10% of success only :( - independent test results required. I see non-zero downloads count, may be somebody (grahama) also can test plug-in :) Another request - english spelling in the InetLoad.cpp (and may be dialog window).
Thanks.
Attached version functionality is almost the same as in the previous post, I only made an attempt to remember "coding rules" and re-formatted source text (for possible cvs commits :).


will do and report back... :)

g


could add a Silent feature ?
something like:
inetLoad::load /SILENT "http://blah.com/blah.jpg" "$EXEDIR\blah.jpg"


will possibly get this thing tested today :)
g


great news :)
initial tests from a client came back successful...
I'll go there myself to make sure later in the week...
but this is very good news as nothing was getting thru with nsisdl
g


Many thanks, grahama. I'll add this option (I tested right now - plug-in can take string from the stack and push it back if this is not /silent parameter :) ), but let's wait a little for another replies.


New plug-in version with /SILENT support (optional).
Usage:
InetLoad::load [/SILENT] URL1 local_file1 [URL2 local_file2 [...]]

Returns "OK" string if download successful

Pop $0
StrCmp $0 "OK" dlok
MessageBox ...
Quit
dlok:
...


thanks for the Silent Feature Takhir

is there a way I could pass along download info to the MUI interface like Nsisdl does ? very cool stuff :)
g


NSISdl uses "files" page for progress bar and status display. My variant uses it's own dialog window and may work even from .onInit function (without installer page) - I know situations when this is important. And I guess it is better to use more space for all these numbers and names displaying - url, local file, file size, done, transfer rate, remaining time, total time, percents. Another words I'd like to keep my dialog :)
I see 2 situations: 1) installer is visible and plug-in window appears as it is; 2) totally silent install and plug-in is also hidden (some logic may require in the plug-in call).
But it may be good to add something meaning above general prograss bar (1006 static, where installer shows file names) :) , for example "InetLoad plug-in".


In the latest CVS version, NSIS passes the silent flag which you can check.

I prefer the download dialog to show inside the NSIS dialog. It looks nicer.


Situation: program requires system SP to be installed ( >100 MB), this was found in .onInit function, but where to download SP? File copy page IMHO is not good place for this, might be better to do this after License page or even in .onInit function. But where to show progress bar if Installer’ dialog window not exists yet or have some other controls in this place (middle of the box). Or developers must create custom page for plug-in? I still guess that dialog box is better way (while dialog design is ugly ). Also: when user closes plug-in dialog window, plug-in’s main (dialog) thread tries to stop or terminate i/o thread – not bad when i/o hangs. When embedded to installer page this is not so obvious.
I added extra->exec_flags->silent support in some #ifdef’s to keep compatibility with current NSIS version (<=2.02). Code attached.


No files should be downloaded in .onInit and anywhere else but the instfiles page. In my opnion, that's an annoying installer. I prefer installers to start "installing" only once I click install and verify all the parameters. But that can an option.

In NSISdl, another progress bar is created for the download status.

Clicking the Cancel button is more obvious than closing the download window.


I saw new progress bar created by NSISdl, but this is OK on instfiles page only, where this place is free. On the instfiles page - yes, this works fine.
When plug-in window is visible, installer page (if any) is unavailable, and (I hope) user will find how to close plug-in window. Or I can add there Cancel button (very easy in VS GUI).
The only place to start installation - yes, this is the best way, but life is very strange thing :) NSIS gives a lot of user vars to plug-in (but not silent state), this looks as very specific option (back door), so why not to give opportunity to download file in advance?


The dialog area is free when a plug-in is called inside a custom page callback function.


for myself, I use banners in the beginning to alert the user of a version check....I download an ini file and compare it to the values in the registry...because the inetLoad plugin is larger the banner...it looks a little strange...This is only cosmetic, but I thought it was worth bringing up:)
having all the strings passed to the MUI [instead of the plugin dialog window] would be helpful in this particular situation...


Ok, I went over to Univision's [the client] corporate office and inetload did not work with their proxy network :( [nsisdl does not work either] My client launched the wrong installer...and told me it worked....
I am kind of at my wits end with this...Is there another installer product that works with proxy or is this something in the queue for NSIS...here is something odd that might be of note. My Apple powerbook[OS X] using Virtual PC [Win2k] gets thru their network on DHCP. Using the same installer app on THEIR pc does not get thru..... What would this point to ?
many thanks as I considering hard drugs at this point ;)
g


I'm having a problem too with my work's proxy. When i try to use inetload to download a text file, the text file's contents are overwritten with the page can not be display message, and the following:

HTTP 407 Proxy Authentication Required - The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied. (12209)
Internet Security and Acceleration Server

Any ideas? Thanks all.


It’s not easy to debug program if you cannot touch the problem with your own hands J
I made one minor improvement for error 407 (proxy authorization), might be good to test it. But the main question is in explicit proxy authorization if IE registry parameters (already used) are not enough for connection. This require user_name and password. I see 2 simple ways to resolve the problem, silent InternetSetOption(INTERNET_OPTION_PROXY_PASSWORD + INTERNET_OPTION_PROXY_USERNAME) if these parameters presents in the plug-in call (something like “load /PASSWD=passwd …”) or popup dialog (InternetErrorDlg for example), where user can enter name and passwd for proxy auth (not works in the silent mode). Both variants may present in program, of course. First is good for corporate network distribution, second – for Inet downloads. If this is what you need – I’ll be in office in Monday and can make changes next week.
Also few words about http server authorization (error 401) – it is possible to define name and password in the URL, program extracts both parameters (if any. I did this for FTP if anonymous user is not accepted).


SUCCESS!! Your new inetload cut right through my company's proxy! Thank you so much Takhir.


Takhir, I found a minor issue. Your plugin is still working beautifully, and getting through my proxy with out any problems, so thanks again.

I'm using your plugin with nsis 2.03, no MUI, and with a silent install. I'm just using message boxes and banners. If I run the InetLoad::load command with the /SILENT switch, all future message boxes appear in the background behind other windows. If I remove the /SILENT switch from the InetLoad::load, which is fine, message boxes appear in front as they should. I tried using the BringToFront command, but that did not work. Just wanted to let you know about this, but all in all, your plugin is working great!


Could not reproduce with 2.02 - works fine, but this happens with 2.03 (on my home Win98SE) :( And $HWNDPARENT is NULL, we cannot use SetForegroundWindow() syscall to improve your situation. May be NSIS devs can say something? Plug-in always creates it's dialog window (required for download sync), it is hidden in silent mode and has NULL parent, but I don't know how this can cause later abnormal bihavior of 2.03.
BTW - question to NSIS developers - while I see $HWNDPARENT == 0 in the 'SilentInstall silent' mode, can I use it instead of new 'extra->exec_flags->silent > 0' flag ? Is this a reliable way?


No problem Takhir, thanks for looking into the minor problem. I don't mind running your plugin in non-silent mode, which corrects the problem. I'm still very pleased that your plugin gets through my proxy, so thanks again.


You can simply download and install 2.02 version - InetLoad worked fine with it silent mode. Problems appears in 2.03 only (and this not the first situation with 2.03).
Attached version recognizes silent installer mode even without /SILENT flag in the plug-in's call.


extra->exec_flags->silent != 0 is the most reliable way to detect silent installers. That is what NSIS itself uses.


great :)
I am no longer having proxy problems either...Just tried it again today at their corp headquaters. Is there any possibility that this plugin could be integrated into the the MUI ? In my case, it would look a bit slicker....as I was using nsisdl...
great job, Takhir :)
g


I'll think about command line switch to support both modes ;)


Originally posted by Takhir
I'll think about command line switch to support both modes ;)
That would be a very good idea. I'm also using NSISdl, so if you could implement NSISdl's dialogue features into yours (including the text string settings) then that would be awsome.

-Stu

I just started using this little dittie, but had to put the whole dialog into silent mode. With the ns dl'er the full path was that was downloading was not shown, I preferred that. Is there a switch you can add for /hideurlprefix or /showfilenameonly or something like that, thanks.


First draft, but I could load some files with it :)
Requires 2.03 – new plug-in parameter in this version is the only way to auto-recognize silent install without explicit /SILENT parameter on any step including .onInit (where main installer window not exists yet).
/TIMEOUT parameter not implemented because MSDN describes many timeout flags (connect, receive, control send and receive, data send and receive…), so I guess would be better to left defaults.
/POPUP key displays detailed download dialog instead of embedded progress bar. Very useful in .onInit function (i.e. not in Section). So default is old (NSISdl) GUI :(
/SILENT key explicitly prevents from displaying of any plug-in' output (both popup dialog and embedded progress bar). Not required if 'SilentInstall silent' mode is defined in installation script.
Now plug-in displays short file name (like NSISdl did)
And I still hope that NSIS developers can solve 2.03 problem with new windows going to background in the silent mode (this worked fine in 2.02).


I tried the plugin with the NSISdl interface. I found one problem...

My title control (1006) has a transparent background (because you can't not have a transparent background when setting text colour using SetCtlColors for some reason). When I use InetLoad I get two layers of text on it: InetLoad plug-in and [download name].

Edit: Could you also change it to "Downloading [download name]..."

To fix the problem you need to refresh the label control by hiding it and showing it again and then set its text.

-Stu


Archive: http + ftp download plug-in


Might be better to give me test script, but I did some changes - redraw not tested.
1006 redraw (RedrawWindow(with erase background))
Downloading ...
Connecting now appears at the beginning of download.


The problem is still there with the overlapping text.
Compile this example; it shows the problem.

-Stu


Updated. Tested on Win98 SE and WinXP Pro.
And I still hope that InetLoad sounds better then NSISdl ;)


Works beautifully, well done!
I will convert my installer over to InetLoad :)

-Stu


Ok, I found some really dodgy weird bug.

If I Push two things onto the stack before calling InetLoad, InetLoad always fails and returns either "File Open Error" or "URL Parts Error".
InetLoad returns "File Open Error" if I have two empty strings ("") onto the stack, and "URL Parts Error" if I have two non-empty strings on the stack (ie "blah").
If I Pop one of them off immediately, InetLoad works as normal!
It seems that if I have more than one item on the NSIS stack, InetLoad fails.

This example shows the problem...
Compile it and you'll get the problem straight away.

Edit: Have you got code in there to read the URL and the save-to-file from the stack? Nothing in the readme about it!!!
And it's not reading from the top of the stack either, more like either at the bottom of somewhere in-between!

-Stu


Could you just remove the stack support? For some reason because I'm using the stack a lot in this installer InetLoad messes the stack up completely (it seems to move things on the stack around!)

-Stu


If I Push this onto the stack first:
"ja"
"ja"
"$EXEDIR\GameVer.muf"
"http://myweb.tiscali.co.uk/imker/Updater/Games/hostile.gdf"
""
"$EXEDIR\GameVer.muf"
"http://myweb.tiscali.co.uk/imker/Updater/Games/hostile.gdf"

Then I call InetLoad, the stack becomes just:
"ja"

Definately something strange going on there :p

-Stu


This is not a bug, Kichik asked to add multiple files support, as many as plug-in can find in stack. This is why plug-in reads stack till the bottom. If plug-in cannot read both URL and file_name (one string presents), it exits with OK code, but if 2 strings comes from stack and one is not URL or another is not a valid file path - it fails with some code.
And one more redraw of 1006 control on exit added, sorry, it's for 'Completed'.


You need something in the plugin to check when the URL's Pushed on to the stack end. E.g.

Push "start urls"
Push "url 1"
Push "save to"
Push "url 2"
Push "save to"
InetLoad::Load /SILENT

InetLoad just needs to keep Popping off the stack until it finds the string "start urls" (or something).
Currently it's Popping everything off the stack in case that it's another download URL. This is silly because we might need to use the stack for other strings as well. We call InetLoad and after that they're all gone!

Edit: I don't think Kichik told you, but this has to be the default behaviour. Check out all the NSISdl macro's on the archive which do exactly the same thing...

-Stu


I can add /END parameter for such situations, for example

Push "bla"
InetLoad::load /POPUP "http://myweb.tiscali.co.uk/imker/Updater/Games/hostile.gdf" "$EXEDIR\GameVer.muf" /END
Pop $R0
MessageBox MB_OK $R0
Pop $R0
MessageBox MB_OK $R0
Second MessageBox says "bla" in my test ;)


Ah very cool! :)

I will try it out in a few minutes (when my map finishes compiling).

-Stu


Just curious then... How does the plugin know whether to get the URL's from the stack or from the command-line. If no extra params exist on the command-line then it reads from the stack?

If it reads from the stack, then how does it know when to stop?
I might think about using the stack to pass multiple URL's...

-Stu


Plug-in takes all parameters from the stack only. And I thought this is mainroad of NSIS plug-in usage (or I misunderstood something?). Installer pushes command line parameters to stack before plug-in call, plug-in uses popstring() for [IN] parameters and pushstring() for [OUT] result (because all plug-in entry points are 'void' type). I guess :)


Oh I see now. I didn't know that sorry :D

It now works bloody perfect, excellent! I can now distribute my installer (wahoo!)

-Stu :D


Last version archive page http://nsis.sourceforge.net/archive/...instances=0,32


I tested new version, it supports MSI banner mode, two parameters set this window caption and text "/BANNER CAPTION TEXT". Multilined text may be created using $\n character in the TEXT string, up to 3 lines I could add there. Plug-in displays package first icon in the top left corner of the banner window. Progress bar appears when (and if) file size comes from server, so if file size is unavailable (chunked reply, very seldom for static files) or file size is < 8 kB and line is fast, progress bar may stay hidden.


I've just notice a little issue with the status returned after downloading. I've seen this on Win2k & XPsp1 systems so far, what happens is that InetLoad return "1" instead of "Ok" after succesfully downloading a file. Here's my code snippet that I'm using with 2.05:

  InetLoad::load "${PRODUCT_URL}$WEBFILE" "$TEMP\$WEBFILE"

MessageBox MB_YESNO|MB_ICONQUESTION "$0" 0 0
StrCmp $0 "Ok" 0 dlskip

ExecWait '"$TEMP\$WEBFILE" /q'

Delete '"$TEMP\$WEBFILE"'
dlskip:


Had to change "Ok" to "1" to get it to work again. Using the archive 1/18/2005 build.

Originally posted by mrtech
I've just notice a little issue with the status returned after downloading. I've seen this on Win2k & XPsp1 systems so far, what happens is that InetLoad return "1" instead of "Ok" after succesfully downloading a file. Here's my code snippet that I'm using with 2.05:
  InetLoad::load "${PRODUCT_URL}$WEBFILE" "$TEMP\$WEBFILE"

MessageBox MB_YESNO|MB_ICONQUESTION "$0" 0 0
StrCmp $0 "Ok" 0 dlskip

ExecWait '"$TEMP\$WEBFILE" /q'

Delete '"$TEMP\$WEBFILE"'
dlskip:


Had to change "Ok" to "1" to get it to work again. Using the archive 1/18/2005 build.
Don't you have to pop the return value after InetLoad? I don't see it from your code.

oops, thanks.


2 updates: Resume option (for really bad connections :) ) and ftp "file not found" check out. If resume option set (/RESUME "Do u want to retry?") and error occure (except "not found"), plug-in first asks user to check connection. Many thanks to Afrow UK and azmoviez for ideas and help.


Takhir,
is it possible to set proxy settings (proxy/port/user/password) for your plugin inside the NSIS script?
Thanks


Proxy authorization support added. New command line options:

/PROXY IP:PORT - overwrites current proxy settings, not required in most cases, because IE settings will be used by default.
/USERNAME LOGIN - proxy username
/PASSWORD PASSWD - proxy password

For example
InetLoad::load /PROXY 55.55.55.55:8080 /USERNAME nick /PASSWORD jagger ....

BTW URL can also include target server login/password, CrackUrl function recognizes it, something like this (remove spaces after : , :+p= :p ) : http://username: password@www.whatever.com/secret/eyesonly.htm

Many thanks to Yurik for tests.


I have few similar requests, so new option:
/POPUP PREFIX
sets first part of the popup dialog caption (prefix), for example
/POPUP "Some text"
displays:
Some text - Connecting...
You cannot skip this parameter, but can use
/POPUP ""
for default ("InetLoad plug-in").


I have tested the plug-in on Windows XP SP2. The HTTP download went well, but the FTP download failed. I have Windows Firewall turned on and it popped up a message asking me if I want to allow the installer to connect. InetLoad gave me an error message before I could unblock it. When I tried it again, after it was unblocked, it just failed with the same error message - "Open URL Error". The URL in the example seems OK. I was able to open it using Firefox.


Now I work on XP Pro SP2 too, new project http://www.modya.com requires this :(
MS Firewall bihaviour is so strange :) I deleted InetLoad from exclusions list, firewall popuped "restricted access" dialog, but I could see on the NSIS window under this dialog (I not closed it) that 25 MB download was continued and finished with OK status ...
Nevertheless, first question - MS Firewall connection error, simple patch: /RESUME "" option, I re-tested this, plug-in popups messagebox and continued download attempts after I clicked "Retry". Better way - specific firewall error, this case plug-in can auto-enable resume option (if install is not 'silent'). I wrote above that I could not reproduce situation, so KichiK please test attached dll, it should display messagebox with lasterror and InternetGetLastResponseInfo (if any). The only code I saw in the similar situations earlier with other programs was 12002 (when Firewall threated conection as virus atack).
Second question - InetLoad is in the Firewall list, but still connect error occure - no ideas right now..


I didn't get any new message box using the attached DLL. Still the same "Download Status: Open URL Error". I should have included the "Download Status:" part in the last message. It seems the download does start because it updates the file size field (17kb). But then the firewall dialog opens and the failure message pops up.


Great plugin!
Does this plugin support timeout parameter like nsisdl ?


Attached version supports ;)
InternetSetOption flags include few timeout parameters, but I guess connect is what you want.
Also:
1. ftp client works in the passive mode, all modern servers support this.
2. On firewall error plug-in (if not in the silent mode) auto-enables Resume option and displays message box, so user can solve firewall problem and click Retry.


Really cool, will set about updating our installers!
Quick question - when i used NSISDL i hacked together a method of allowing the user to quit out of the installer and pick up the download when they reran it (not very pretty but it helps for people downloading large files over dial up)
Is there a way of doing this more elegantly using the retry functionality you have in here (ie is there some way of persisting the status of download and picking it up again)?


1. If connection to server was lost, but some data were received during last session, plug-in makes a short pause, reconnects and continues download from the current position. A some kind of re-get.
2. If /RESUME "" option set, plug-in on any error except "file not found" first asks user (retry-cancel), this helps on dial-up connection and firewall problems.
2.5 On GetLastError()==12002 or 12003 (in most cases firewall related) plug-in auto-enables /RESUME option, but please note that english default text will be used in the message box (many thanks again to Stu from Shropshire for the great text :) ).
Finally plug-in returns "OK" or error description string (full set of strings in the InetLoad.cpp file), so on error you can ask user again or terminate installation. You can find all plug-in command line options in the Readme.txt (including 3 display modes).
I hope all these tricks may help to solve some common download problems :)


Hi Takhir, Is persisting the download session possible, such that a user may actually quit out of the installation and on the next run auto resume the download? obviosuly the logic behind this would be in the nsis script itself, but its more a question of how easy it would be to have say a retry now retry later and cancel options on that connection failure box.


I've got an interesting problem with Inetload. I haven't really found any info on something like this, but I've been scratching my head for a few hours and I just can't seem to figure it out. I copied the Inetload command from the example in the plugin archive and added a file of my own on a new command right after it, just like so (on multiple lines to try not to break page's design):

InetLoad::load /POPUP "http://www.dreamgirlswallpaper.co.uk/
fiveyearsonline/wallpaper/Cameron_Diaz/camerond09big.JPG"
"$EXEDIR\cd.jpg"
InetLoad::load /POPUP "ftp://my_server/patches/patch1.exe" "$EXEDIR\patch1.exe"

The above code WORKS without any problems. But now the interesting thing (at least to me), the moment I delete the first line, the Cameron Diaz pic dl, the whole thing stops working! To be more specific, the installer downloads the file just like it did previously, but as soon as it obtains the file, the installer crashes! I started to play around with this some more, and I further came to the conclusion that if I even change the Cameron Diaz pic to ANYTHING else, the installer crashes after obtaining the files. Now, I don't know if this is a cruel joke to make us all download that file, but I really can't figure this problem out. But, I'm just a "simple" web programmer so what do I know about these complex NSIS scripts and plugins. Any help would be GREATLY appreciated.

First of all if you are using latest plug-in version, popup parameter includes 'prefix' text, to use default it should be /POPUP ""
Code above should not work because first download result - 'OK' string (from Cameron :) ) is in the stack yet, please use Pop $1 (for example) after every download to clean stack. Otherwise 'OK' string will be first parameter for the next plug-in call. If you are using stack for other vars, use /END parameter (see Readme) to stop plug-in's stack reading at the end of this command line. Plug-in also supports few downloads from one command line.
And now some single ftp download, re-tested:


Section "Dummy Section" SecDummy

InetLoad::load /POPUP "Readme.txt from MS FTP" "ftp://ftp.microsoft.com/MISC/ReadMe1.txt" "$EXEDIR\rm.txt" /END
Pop $0 # return value = exit code, "OK" if OK
MessageBox MB_OK "Download Status: $0"

SectionEnd


Status 'OK', file looks correct too. I aslo tested big ftp download with login:password in the LAN, and not found any problems. And I hope that bad syntax only might cause crash :)

Does this plug support rtsp or mms protocol ?


http and ftp only. rtsp(tcp) - no, rtsp over http - I am not sure, but if you want (and can) save all content to file (using http as transport) - may be (not tested). But please note, http and ftp support GET method only. Probably the same with mms.


CrackUrl() string buffers length bug fixed (256->NSIS string_size).


Hey Takhir, just wondering why with InetLoad I only get a maximum of 30kbps download speeds on all servers when through browsers I usually get 80-120kbps.

Other people have the same problem too.

Edit: Same problem with NSISdl too :(

-Stu


I was wondering if you could implement the NXS progress banner into InetLoad, so we could have just a simple progress bar when downloading small files between pages.

Also, how easy would it be to write a BitTorrent plugin that works. I've tried the one on the archive (written in Python) but it doesn't seem to work at all.
The actual example is very poor too.

-Stu


Now I'm trying to get InetLoad to execute a PHP script on the internet. Everytime it says File Open Error, when the script is executed fine through my browser.
I've even tried setting the Content-length header and then it works in NSISdl, but still not with InetLoad.

I tried the post example script you made, but that doesn't work for me either. I'm wondering if it's the server, but if it works with NSISdl then surely it can't be...

Please help :(

Edit: LOL now it's working. Because I'm using CallInstDLL to call the plugin, I had the URL and local file Push order swapped :p

-Stu


Originally posted by Afrow UK
Hey Takhir, just wondering why with InetLoad I only get a maximum of 30kbps download speeds on all servers when through browsers I usually get 80-120kbps.

Other people have the same problem too.

Edit: Same problem with NSISdl too :(

-Stu
Stu, I just tested it on my work PC, i was getting around 1360kbps which is about 90% of our T1. I'm using the InetLoad from 3/3/05, which is probably this one. Hope this helps.

Jnuw

Archive: http + ftp download plug-in


Thanks, I'll try it.

-Stu


Long 50 second delay after download
Wow, inetload is a great plug-in!

I have a packaged installer that grabs a file over the 'net, and it's working great aside from a small problem that happens after a successful download.

After a successful download, there is about a 50 second delay before the installer continues. I've put message box popups at each step of the installer, and the delay is immediately after the inetload:load command.

Any idea where this delay is coming from? It doesn't seem to have anything to do with the size of the download...?

Thanks,

Tony


Now I am online again and I'll check all problems tomorrow.
tbrandner: I saw delay on the plug-in exit (cannot remember precisely when & where), but this happened after last plug-in operator (probably in the NSIS code). Can you give me script sample?
Afrow UK: last version worked with my office 8 Mbit/sec line. I can test script sample if required. And I need to understand bittorent protocol first, I'll try :)


Thanks Takhir. If you can get BitTorrent to work, that would be amazing!

-Stu


It's ok Takhir, thanks to immadster the author of XBTT http://sourceforge.net/projects/xbtt/ has agreed to make a BitTorrent plugin for NSIS.

Not sure exactly how long it will take though.

-Stu


i'm just switched from NSISdl to InetLoad, as NSISdl does not support URL encoded login/password. i'm using a function that reads a set of URLs from a text-file and downloads one file after another. i experienced that InetLoad uses to crashes my installer quite often, without a recognizable pattern.

edit: this only seems to happen when running InetLoad in a loop. when i downloaded 10 files with 10 InetLoad commands i experience no problems. any fix or workaround?


Yathosho: This may be blank space in the URL or \r - \n at the end of line. I can fix, but I'd like to understand the problem first. Script sample? :)
Afrow UK: Just tested SP download 130 MB - 13 sec in the 100 Mb LAN.


Originally posted by Afrow UK
I was wondering if you could implement the NXS progress banner into InetLoad, so we could have just a simple progress bar when downloading small files between pages.


Following "banner" mode has not Cancel button (but Esc key works):

/BANNER CAPTION TEXT

For example:
InetLoad::load /banner "Cameron Diaz" "coming soon" "ftp://...."

I cannot remeber right now why I removed x button from the banner dialog, but I can put it back :)


afrow: could this be a Qos related problem?

takhir: send you a private message!


Yathosho I couldn't find anything related on that link...

And thanks for the banner Takhir, I'll have a look at that now.

Edit: Oh it doesn't have a progress bar though. I've already got a banner showing but a progress bar would be nice too.

-Stu


Assistance needed
Hello all,

I am a poor downtrodden Senior Tech (well..thats how I feel at the moment anyway). Have been using NSIS for +-8 months to convert those pesky batch files to something even my junior engineers couldn't mess up.. then came SALESmen...who saw what I could do and asked a favour...could I create an installer for an offering that installs multiple 3rd party apps silently...no problem I say...and I get it working...THEN they change the goalposts with a live demo ...TOMORROW!!!
Just had to tell the story as I feel a lot of techs and devs will have had the same experience...anyway...goalpost change was to download the installers from an FTP site rather than sending out disks to the client...great, but there are multiple files in the ftp locations.

And here is the question...maybe I am just tired and cranky...inetload is excellent but I can't find a way to download all the files in an FTP location without specifying them individually...please tell me I am missing something and it is easy - either way, I think I will go and apply a hammer to the frontal lobe while I wait for a response. The way my brain is working, some example basic code would help.
Thanks


Afrow UK: progress bar appears on the banner if file size info is available. May not appera on the short files (<8 kB). Known problem - this is not 'cross page' banner (like nxs is), plug-in returns when download is complitted only (or error occure).

Wishdoctor:
> TOMORROW!!!
Not implemented :(
This require ftp 'mput' command, but I don't know (right now) how to handle ftp control and data connections in this case. Needs some investigation.
You can also pack server files to the single archive file and use one of NSIS decompression plug-ins.


Don't know if this is a bug or by design but calling the plugin from a Section in /silent mode still brings up "InetLoad plugin" in the details text label at the top.

I'd like to display "Downloading [file]..." (w/ DetailPrint) there instead which just gets overwritten.

-Stu


This is option. You can change this with following code beginning line 832 of InetLoad.cpp


if(hwndParent != NULL &&
(childwnd = FindWindowEx(hwndParent, NULL, "#32770", NULL)) != NULL)
{
if(!silent) SetDlgItemText(childwnd, 1006, PLUGIN_NAME);
}
else InitCommonControls();

And rebuild project (Release).
Idea was to left "InetLoad" word somewhere :) May be I'll remove it in the next version (with POST option support, if it will be successfully tested not on my comp only).

Umm I'm using Visual C++ 2003 and I get these errors on compile:
d:\Program Files\NSIS\Contrib\inetload\InetLoad.cpp(48): error C2365: 'FtpCommandA' : redefinition; previous definition was a 'function'
d:\Program Files\NSIS\Contrib\inetload\InetLoad.cpp(521): error C2659: '=' : overloaded function as left operand

-Stu


Special build - text for 1006 control as /silent 'some text' option. It looks like NSIS cleans this field before plug-in call, so you cannot use script to set text. Usage sample in the attached file.


Mmm I tried that DLL and I think it's taking 'some text' as a download URL.

If I use /SILENT "blah" [url] download fails but if I use /SILENT [url] it does not fail.

-Stu


Sorry, wrong file :(


I need this To Work With InetLoad.


Pop $0

MessageBox MB_YESNOCANCEL "Message" IDYES LABEL1 IDNO LABLE2
Quit


What do I Say After Pop $0 to Get it to
Pass The MessageBox and Quit Code if
Successful?

-MichaelFlya-

Pop $R0
StrCmp $R0 ok +3
MessageBox MB_YESNOCANCEL "Message"
Quit

-Stu


Thx Works Well !!

-MichaelFlya-


Updated - not skips current download if "Enter" key was pressed.
And /SILENT now with text parameter, use
/SILENT ""
to display default "InetLoad plug-in" in the 1006 control (install progress text on the top of the NSIS window).


Great Thanks Takhir !!! "Enter" Button seems to no longer
be a problem.

(Please help me troubleshoot.)

While in /BANNER mode, on the Banner it will show what I
want, but above the loading bar it just shows "InetLoad
plug-in", I'd rather it be what I want.

I may be wrong, you may have put it in some how. It seems
you need one more text input for the dialog shown above
the details while in the Banner mode. like the Silent mode
now has. If you have it already how would you do it?


InetLoad::load /BANNER "Displays on banner." "Displays on banner." "URL for file" "Directory for file"


You have two text fields available, can you add three?

I think it is "Set TEXT2DISPLAY to 1006 control". I don't
know how to set that manually. How would I?

-MichaelFlya-

In the Banner or Popup modes this text appears on the background window (NSIS dialog), so user can see: 1) installer's Fileinst page; 2) files installation step - "InetLoad plug-in" text in the 1006 field; 3) Inet file download progress on the popup or banner window. In the NSISdl or Silent modes level (3) is absent and details can be moved to second level, but IMHO this is not realy need for Popup and Banner. And I'd like to left "InetLoad" text somewhere on the screen ;)
It looks like installer (NSIS) clears this field before plug-in call, so it is not possible to set 1006 control text from script - it will be removed.
But, any case, thanks, I'll think about you idea :)


Oh ok. It would be nice to say something besides InetLoad
the user doesn't need to see that. On long downloads it is
there for a long time. It is off topic for the installation.
Thank you very much for taking the time to respond. :)

Here is an idea that I would need somewhere down the line
and saves time. Your idea is to tell the plug-in to go to a
url then specify it's place on the hard drive to download to.
Then do it again for another file on the same line.

I think you should have another mode that allows you to
tell the plug-in to grab files from one url on the Internet
then without having to type the directory or url again just
specify the files.

so something like this:


InetLoad::load /NewSwitch /ExistingSwitch "Text" "Text" "URL" "Directory to download to" "File_01" "File_02" "File_03" "File_04/Etc"


That way you do not have to say "URL for file"
or "Directory for file" again, over and over.

I know you can rewrite the name with a second field after
the file, but in this case it could just keep the same name.

Could make one more Switch for those who want to rename
like this:


"File_01" "Rename" "File_02" "Rename" "File_03" "Rename" "File_04" "Rename/Etc"



-MichaelFlya-

I'm experiencing the 50 sec delay after inetload downloads the file. This only occurs when downloading from ftp. http is fine.

Section "MainSection" SEC01
SetOutPath $INSTDIR
InetLoad::load "ftp://ftpsdk:Rfloatpt@ftp.ati.com/AdbeRdr70_enu.exe" "AdbeRdr70_enu.exe"
ExecWait '"AdbeRdr70_enu.exe"'
SectionEnd


This is second request with 50 sec delay problem, but I still cannot reproduce it. Right now I tested following code and Adobe installation started immediately after download was completed (12.8 MB :) ):


Section "Dummy Section" SecDummy
SetOutPath $INSTDIR
InetLoad::load "ftp://ftpsdk:Rfloatpt@ftp.ati.com/AdbeRdr70_enu.exe" "AdbeRdr70_enu.exe" /end
ExecWait '"AdbeRdr70_enu.exe"'
SectionEnd

2 new options: /NOCANCEL and /NOPROXY
First option prevents download from being interupted by user (locks Esc, Alt-F4, Cancel handling).
Second - disables proxy settings for this connection (if any). InternetOpen() uses INTERNET_OPEN_TYPE_DIRECT instead of default INTERNET_OPEN_TYPE_PRECONFIG.


InternetOpen() uses INTERNET_OPEN_TYPE_DIRECT instead of default INTERNET_OPEN_TYPE_PRECONFIG.
So this will bypass any proxy?

Not tested, because I have not proxy at home :), but looks simple, and MSDN says this flag "INTERNET_OPEN_TYPE_DIRECT - Resolves all host names locally."
"INTERNET_OPEN_TYPE_PRECONFIG - Retrieves the proxy or direct configuration from the registry."
BTW it is possible to disable proxy using HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings ProxyEnable, but plug-in's parameter limits changes with this session only.


"INTERNET_OPEN_TYPE_PRECONFIG - Retrieves the proxy or direct configuration from the registry."
BTW it is possible to disable proxy using HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings ProxyEnable, but plug-in's parameter limits changes with this session only.
Seems, that all that stuff (only) deals with the internet explorer proxy settings. So if the proxy settings are not set within ie (registry) that probably wont work with other external proxies. But thats all theory, I dont have a proxy for myself - so I couldnt test it.

Because writing an Internet Updater with NSIS I am searching a long time for a nsisdl solution (or something similar) which can handle proxies which are not specified inside the ie settings (in the usually registry keys).

Regards,
Mæster.

InetLoad uses WinInet API, by default IE proxy settings will be used. But /PROXY "IP:PORT" option (string will be used as a part of INTERNET_PROXY_INFO structure) option can change proxy list for plug-in.


Can you make it so it won't take the focus ( comes to the front ) every time it downloads a file? I'm making a system that downloads about 6000 (small) files in a row, and it quite effectively keeps you from doing anything else.


Megiddo_Guest
At the very beginnig this feature was requested by Jnum for silent mode, but I did it for all cases. OK, please test attached version - should be not so annoying in non-silent mode.


Is it possible to create something like a patch client to download the latest version using nsis and this plugin? If so can someone maybe give me an hint?


1. Create installer without uninstall section, for example Updater.exe with package download and install functionality. Include it to your distribution package, add link to Start menu. Or execute it in the silent mode once a week from your application. It should send request to server with current version number, server can return new package or "no version yet"\ :)
2. Afrow UK wrote above about bittorent http://sourceforge.net/projects/xbtt/


Originally posted by Takhir
1. Create installer without uninstall section, for example Updater.exe with package download and install functionality. Include it to your distribution package, add link to Start menu. Or execute it in the silent mode once a week from your application. It should send request to server with current version number, server can return new package or "no version yet"\ :)
I'd like something like download a text file from a server in which you see the version required and if lower it downloads and installs what's needed, is this possible?

Yeh sure it is!

Use InetLoad to download the file, then use FileOpen, FileRead to get the version info out. Remember to use TrimNewLines on the stuff you read in case there are any (new lines). Finally compare read value using StrCmp with value in registry or in define (for example).

-Stu


Need some example for an internet updater? Take a look at the "old" NSIS Update Script: http://cvs.sourceforge.net/viewcvs.p...0Update/Attic/


Just one thing for better organisation of inetload plugin.
@Takhir:
Would be great if you just would use the already existing wiki page http://nsis.sourceforge.net/wiki/InetLoad to store the newest version of the initload.zip. Please dont use a link to the forum for the download. I had done those changes to the wiki but i am really unable to find the latest official realease here in the forum in more than 150 replies. A central place for downloading the newest release (the wiki page) is much more better than posting a new reply with a new attachment here in the forum, dont you think so?

Thank you, great work as well.


Archive: http + ftp download plug-in


having a problem with the following code. works only when i use it without login : password

FTPdl::download "ftp://myLogin:myPassword@ftp.myftp.xx/Clip(15).3gp" "$Desktop\Clip(15).3gp" "" ""

Wrong thread or syntax? :)


InetLoad::load "ftp://username:password@ftp.myftp.xx/Clip(15).3gp" "$Desktop\Clip(15).3gp" /end

Originally posted by Takhir
Wrong thread or syntax? :)
got me there, sorry :rolleyes:

I've currently got the 50 second delay... This happens to my script and to the example enclosed with the InetLoad package. Perhaps the delay has something more to do with the system than the script?

I turned off my AV/SW and FW on XPSP2. Not sure what the cause is... Any ideas? Have anyone solved it yet?


60 sec delay
It looks like "delay on plug-in exit" problem comes from WinInet.dll DETACH state (time_wait). I added fix, vbgunz reported that it works now.


Hi ! (sorry if my explanations aren't clear i'm french)

Well, I don't know if this problem has been quoted before.
I'm using InetLoad with MUI to download some files from ftp. There is a focus problem in silent install mode.

Let's say that there is other windows opened when I run the install like explorer, nsis compiler or any other. Each time a file is downloaded in silentmode, the opened windows are focusing each after each. What can i do to avoid that? Did i miss something in the documentation? Because a beginner user will say "hey my pc is going mad!" when he will see the windows changing without doing anything :)


Jnum requested this feature (on the first thread page ;) ), but it looks like most of developers are not happy with it :( OK, I commented "set foreground" call, please test attached version.
And Jnum can use BringToFront NSIS instruction to keep banner foreground :)


Thank you very much :)


Hello Takhir,

If I could make a request it'll be to see an option to add a banner to the default download status window. An option to show a support banner image below the details.

It would be great if the banner could be found either locally on a users drive or preferably linked to on the net somewhere. Is this possible?

Thanks Takhir!


Looking from my corner it would be better to write a new plug-in adding child window with image to INSTFILES (or any other) page (if I correctly understood your idea). Something like AdvSplash (or NewAdvSplash :) ) but for installer pages. This is probably available on custom pages and using InstallOptionsEx (hand cursor and banner link). Another words - this (new plug-in or one of old ones with new option)) may be usefull not only with InetLoad plug-in and not only on the INSTFILES page ;)


Hello Takhir,

The idea was to add a banner below the InetLoad download status dialog box. It would be a part of that dialog box and wouldn't show up seperately...

The reason behind the idea is pretty simple. Since I have plenty of mirrors in which my files could be downloaded, I would like to try and give credit where credit is due.

Instead of packaging these banners into the installer, it would be nice if they can simply be linked to from a website. In the case a banner from the net doesn't wish to show up, it'll be nice to replace it with a sort of default banner.

The best part is if you can make it possible to click the banner itself so the user can visit the mirror in which they're getting the download.

I hope I made sense. Thank you Takhir, I'd love to hear your idea on this. Perhaps Advanced InetLoad?

:)


Hi Takhir :)
is it possible for inetload to show a repeating progress bar when the files are too small to show real progress.
;
In my case, I am downloading an xml file to check for updates. Is it possible for the progress bar to show a repeating or indeterminate time to download the file ? That way you would not have to use nxs or msibanner for small downloads of this type....
g


Hi grahama!
>The idea was to add a banner below the InetLoad download
>status dialog box. It would be a part of that dialog box
>and wouldn't show up seperately...

IMHO this is element of browser window, one level higher then InetLoad stays :)

>is it possible for inetload to show a repeating progress
>bar when the files are too small to show real progress.

What base can you offer for progress bar position if a whole file comes from server with a single message? Time stamps? Or number of files downloaded (may be interesting :) )?
/POPUP window (now with translation - see wiki page ) shows total download time.


Hi Tahkir
;
In my case, the first 'non-eyecandy/useful' thing the user sees is a banner stating...checking for updates...please wait.
;
InetLoad downloads an xml file created from a php/mysql query. And, msibanner is faking progress of that query and download.
Specifically, I move Msibanner forward 10 Times to 50%, inetLoad [silent mode] the file, and then move Msibanner forwards 10 Times to 100%. Very Kludgy but it works.
;
Usually, the query takes longer than the file download.
If InetLoad could simulate a spinning/repeating/connecting to database graphic then I would not need msibanner or nxs [which I will use in all future version as it is way better than msibanner :)].
;
So there really is no file size or timestamp. Basically, you are waiting for mysql/php to spit out an answer.
;
I guess that would be an extra parameter within inetLoad...
;
I do use inetLoad for actual files too. And, it works fantastic. Adding a 'Indeterminate' parameter would make it easier to communicate with users when NSIS is talking with php/mysql :)
;
does that make more sense ?
;
and, out of curiosity, what is the technical name for 'connecting to database' type progress bars ?
;
thanks for such great work Tahkir :)


Hi Takhir !

Does your plugin support an https syntax?
e.g. https://www.blahblahblah.com/file_to_download.exe
Because it doesn't work with my script so i'd like to know where the problem come from.
Thx :)


Since IE removed the format http://username:password@site.com/ , is there any other way to log into a website?


Lightning20 & Megiddo_Guest
Can you attach a short script sample to forum post or PM? Looking from my corner both https and site logging should be supported by WinInet API (even if IE not allows this).


Well, I'm just trying to download a file from the internet. I tried with http files, ftp files to make sure nothing was wrong in my script, and when I tried to download from e.g. https://www.blah-website.com/myfile.exe, it gives me an downloading error.
Does the problem comes from a missing component on the computer or is it simply unsupported at the moment by your plugin?


Lightning20
Please test attached version, if this is OK, I'll update wiki page.


Ok, thanks for your rapidity :)
I have tried several times to download this page:
https://adwords.google.com/select/steps.html
It didn't work.

I also tried http://adwords.google.com/select/steps.html that automatically redirect to https://adwords.google.com/select/steps.html and it works.
So wininet or the plugin has a problem with the https syntax. It seems it doesn't even manage to connect.


I tested last version (with fixed "Type of service to access parameter") with one https connection and it worked. It looks like your server require additional http header because I see SendRequest error. I'll try to understand this later today. Or may be you know what header required?


Sorry I'm a perfect n00b in this domain. I'm just able to write some dummy lines with NSIS :)

But you mean that each https server has its own parameters? Each different server will require a modified version of your plugin?


This only means that I not worked with https connections earlier :)
With INTERNET_FLAG_SECURE I could download page from your link. Please test attached plug-in.


Great, it works fine with https, but... (because there's always a but:) ) it doesn't work when the https certificate is outdated ! (You know, when ie or firefox asks you if you want to continue or not)

Do you think is it possible to avoid this little problem?

e.g with this link here:
https outdated

If not, I will have to use it as it is.
You already did a lot Takhir thank you :)


Ignore_sertificate CN_INVALID & DATE_INVALID as default now, new version is available from the wiki page


Thank you so very much Takhir ! Thanks to you my boss won't cut my throat ! No i'm joking btw your plugin is great :) Keep up the good work!


Hi Thakir !

I'm facing a strange problem with https. All works fine on my laptop with xp sp2. I tried on another pc with win xp, and also with one under win2k, the download from an https url with an outdated certificate doesn't work. Do you have an idea where the problem can come from? Is there any programs or libraries needed to be installed for the working-good of your plugin??


I have sent PM to Lightning21 some time ago asking to test my updates, but I have not any replies :( So new version uploaded, I am the only tester, but code changes were local and (I hope) not added new bugs :)
Updates:
1. https on Win98 (IE 4.0, 40 bit) now works better with invalid server certificate (sample script with URL included).
2. 403 (Forbidden) error code handling added.


Having a problem compiling it - it's expecting a file called exdll.h - is that hiding someplace that I'm unaware of? Doesn't seem to be in the zip file.


exdll.h
Sorry, I forgot that kichik excluded source code from NSIS package. You can take file from latest sources package or just use a file I am attaching to this post (path Contrib\ExDll).


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.

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).

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

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.

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.


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?


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


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


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


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


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"´


Archive: http + ftp download plug-in


${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...

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


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.

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

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.

Yeah, that runs
But not from InstallOptions >-<


Use !insertmacro MUI_INSTALLOPTIONS_READ instead of ReadINIStr.

-Stu


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.

http://sourceforge.net/forum/forum.p...orum_id=539405

Thanks for all your hard work
Dave

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.


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.


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


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.)?


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?


please test
I improved few suspicious places, but I still cannot reproduce am not sure in the new version, please test.


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

http://localhost/adminAPI/dowork.cfm

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


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.

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.


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.


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


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.


Originally posted by 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.
I didn't realize the way the commandline and the stack worked. You were correct that $test was put onto the stack as a single line. I managed to get it to work by push'ing the data to the stack in a loop and calling InetLoad::load /popup to have it pick up the parameters from the stack. Seems to work like a charm :-) Thanx for pointing me in that direction.

Regards

Hi everybody

Is there a way to make the dialog freeze while the download is being made?

Currently, the download uses the proxy settings correctly, but the user is able to press "Back", "Next" and "Cancel" and I don't want it to happen.

Any idea?
Thanks in advance


You can disable the buttons yourself with GetDlgItem and EnableWindow:

GetDlgItem $R0 $HWNDPARENT 1
EnableWindow $R0 0
GetDlgItem $R0 $HWNDPARENT 2
EnableWindow $R0 0
GetDlgItem $R0 $HWNDPARENT 3
EnableWindow $R0 0

This will disable all three buttons.

-Stu


Thanks a lot, now it works just fine!


Hi.
I'm getting faimilar with inect but I have one questiona, as I cant find answer for it. Is it possible to upload on serwer whole directory structure?
Thanks for help


No. Use FindFirst, FindNext, FindClose to scan dir.


Is the DLL made in .NET ?


Nope, .NET not required. Functions are classic dll entry points (__far __pascal == WINAPI). But you can build project under VS 2005 as well - no difference with VS 6.


Just got a quick question... I'm using an NSIS installer with the inetload plugin (bloody wonderful plug-in that it is!) to reduce the pain involved in upgrading software on several hundred machines by having the installer download the necessary updates - one of which is the dotNET framework - all 23mb of it. Dialup sites have a bad habit of regularly failing to the point that they can never finish the download in one go.

I'm trying to use the following line of code to silently download (with resume) the update, but in silent mode, resume does not seem to work. It works fine in normal mode, but the problem is that there *isn't* someone watching the machine to click the Retry button.

inetload::load /resume "" /silent "Downloading dotNET framekwork..." /popup "Downloading..." "http://172.25.254.151/appupdates/updatepacks/dotnetsilent_adbox.exe" "$OUTDIR\dotnetsilent_adbox.exe"

Can anyone give me any ideas how I might resolve this problem?


Try to comment line 976 in InetLoad.cpp source code and rebuild project, should be (not tested)


// if(silent) resume = false;

Thanks for your quick suggestion Takhir, however I'm now running in to a problem previously posted on the forum that I can't spot a solution for - namely, I'm getting the following compile errors:-

error C2365: 'FtpCommandA' : redefinition; previous definition was a 'function' (@ line 64)
C2659: '=' : overloaded function as left operand (@ line 633)

C++ isn't my specialty - I *can* program, but it's not what I do for a living and for that reason, whenever I need to knock something together I either use NSIS or VB.


Just replace FtpCommand with myFtpCommand, use "whole word" option on replace. It is important for this line:


myFtpCommand = (FTP_CMD)GetProcAddress(hInstance, "FtpCommandA");

Is it possible to RESUME download of already existing file?


Is it possible to RESUME download of already existing file?
No. Please use 4.9.4.10 IfFileExists jumps to handle the situation.

That's a pity even though inetc is not a download manager. Still there is another bug not connected with RESUME:

When inetc is called in .onInit installer window is started in background and BringToFront doesn't work afterrwards.

The command used is

PHP Code:


inetc::get"http://www.mingw.org/mingw.ini""$EXEDIR\\mingw.ini"/END


NSIS BringToFront manual notes this new OSes behaviour. Use /banner or /popup to keep focus.


I haven't found the instructions. It is said that

If an application was executed that shows itself in front of the installer, a BringToFront would bring the installer back in focus.
But AFAICU there is not separate application executed. In fact the inetc command above is meant to be launched with /SILENT key for quick check if there is a newer version of installer available. Maybe it is possible to do something so installer will not lose the focus?

4.9.14.1 BringToFront
...
Recent Windows versions restrict the setting of foreground windows. If the user is working with another application during installation, the user may be notified using a different method."


Finally this means that none of SetForegroundWindow, SetActiveWindow, SetWindowPos can sets window to foreground and give it keyboard focus (now). Taskbar button flashes instead. But Inetc sources include commented sf() function - this worked but was removed later. You need to call this directly from installer, may be using System plug-in.


Still can't get the logic. Installer does not execute any external programs to lose focus - it merely calls a function from DLL. In addition I do not have any recent windows version (W2K only), so this should work for me, but BringToFront doesn't work after a call to inetc.

Maybe there is a misconception in inetc which tries to operate with some of its windows even with the /SILENT switch - this causes installer to lose focus to these windows and they fail to return it back? Could this be possible?


This is not Inetc related problem, the same (under some conditions) happen with splash windows, banners and even outside NSIS ;) http://forums.winamp.com/showthread....t=BringToFront
Please use forum search - you are not first :) and most of questions already have answers..


Archive: http + ftp download plug-in


BTW, I did't want to mess on the other thread, the plugin is just incredible!
Thank you!


Thanks, Red Wine :)


Hi, Im having a few problems, when i run my download installer I dont receive a dialog box with the download progress. However I did with the older version in the quote below. The latest one does download the file but totally silent.

My line reads as follows

InetLoad::load ${PDFURL} $PROGRAMDIRECTORY\CoolPDF.exe

As I said, it worked fine with older versions but the latest just doesnt show any progress.

Thanks


Originally posted by Takhir
It�s not easy to debug program if you cannot touch the problem with your own hands J
I made one minor improvement for error 407 (proxy authorization), might be good to test it. But the main question is in explicit proxy authorization if IE registry parameters (already used) are not enough for connection. This require user_name and password. I see 2 simple ways to resolve the problem, silent InternetSetOption(INTERNET_OPTION_PROXY_PASSWORD + INTERNET_OPTION_PROXY_USERNAME) if these parameters presents in the plug-in call (something like �load /PASSWD=passwd ��) or popup dialog (InternetErrorDlg for example), where user can enter name and passwd for proxy auth (not works in the silent mode). Both variants may present in program, of course. First is good for corporate network distribution, second � for Inet downloads. If this is what you need � I�ll be in office in Monday and can make changes next week.
Also few words about http server authorization (error 401) � it is possible to define name and password in the URL, program extracts both parameters (if any. I did this for FTP if anonymous user is not accepted).

I re-tested InetLoad and could see correct download progress (Nov 4 2006 version, XP Pro). You can download and test old version from http://nsis.sourceforge.net/File:InetLoad.zip or try to use Inetc - function name is get (Inetc::get) and embedded dialog code was improved there.


Its weird, use the old version in the post above and all works, use the latest and it just wont show.

Do I need any other commands to make it show or should

InetLoad::load ${PDFURL} $PROGRAMDIRECTORY\CoolPDF.exe

work?

Thanks


I compared last source with March 12, 2006 version and don't see any related code changes. What is your 'old' version? And (again :) ) Inetc behaviour is more stable in old (NSISdl) display mode.
In your code following might be better (the same for Inetc)


InetLoad::load ${PDFURL} "$PROGRAMDIRECTORY\CoolPDF.exe" /end
Pop $R0

dannyoneill,

Are you by any chance making multiple calls to the plugin? e.g. downloading more than 1 file.


at the moment im downloading one then later another. But I have tried it with just one file. Old plugin fine, new one nope.

I can make the full script available if thats of any help. Its for CoolPDF Portable.


hmmm... I have had similar problems with Inetc and downloading more than 1 file where the progress is not displayed at all.

Attaching your script is probably a good idea.


Good idea is to attach a short script reproducing the problem ;)


I have had similar problems with Inetc and downloading more than 1 file where the progress is not displayed at all
Are you using Inetc in NSISdl mode? Some servers do not supply the size information so Inetc cannot provide a progress bar which "moves" (because it does not know how big the file is). The progress bar stays "empty".

Try using Inetc's POPUP mode - in the popup the plugin will tell you if the size is unavailable but it will show you how much data is being downloaded so you can tell something is happening.

I forgot to note that progress bar may not appear if file size is less then 8 kB (data bufer).


I'm using Inetc in NSISdl mode, file is > 8kb and server definitely sends filesize as 90% of the time the progressbar shows up for the first download, but completely disappears for the second one and any others after that.

The label showing status message always works fine though.


a minor problem
I am using your wonderful plugin yet I seem to be having a little problem I do not know what it is related to.

I am using the /TRANSLATE switch with the following, among a few, text: "Downloading SuperMemo 2006 (13.01 Beta I from Jan 22, 2007)..." (skip the quotation marks)
Yet the text displayed about the first progress bar sheds the last 4 chars: ")..."
Could you please tell me what the reason is??

Thank you in advance,
Mike


I've put to wiki new version with increased string buffers. Next time please attach a short sample demonstrating the problem, it's not easy to find situation basing on the text 'among a few' :)


label too narrow??
Thank you. Unfortunately, the problem persists.

Here can you find a more detailed description with a screenshot: http://forums.winamp.com/showthread....hreadid=264467
Thank you for your help.
Mike


possible inetc problem
Making mention of this here in case it comes to appropriate individuals attention sooner than the actual bug report...

For description of possible problem, please see:
http://sourceforge.net/tracker/index...49&atid=373085

Thanks.


I added KillTimer to wiki release, but probably you used pre Sep 7, 2006 version in NSISdl mode. System should kill all timers and messages queue when window destroyed.


I have managed to solve my problem. The original line of source code looks as follows:
Downloading SuperMemo ${strSMYear4D} ($strSMVerTag from $strSMVerDate)...
The values of the last two variables (i.e. $strSMVerTag and $strSMVerDate) are read from a text file downloaded from the web. The reason why ")..." kept being truncated was that the value of $strSMVerDate had new line at the end of it.
It is solved now. Thank you for your help.

On a related topic. The InetLoad readme text file advises to peek into the source code (i.e. InetLoad.cpp) for a full set of status strings. I am particularly interested in error status codes. I did look into the code but found not entirely satisfactory for an FAQ I am planning to write accompanying the installer. Since InetLoad is based on WinInet API, is there somewhere a list of error codes I could be referred to??


The release I have contains last comment dated 1-jan-2007. (This may not be what was used in the actual build of the released mingw installer - I didn't build that one, I'm just trying to figure out why it sometimes crashes on me.)

But, for the wiki release...

I see no mention of a KillTimer() call in inetc.cpp.

I searched everything expanded from the archive, and get no hits on "KillTimer".

I do see a call and comment that is presumably used to generate an extra call to WM_TIMER functionality, i.e. PostMessage(hDlg, WM_TIMER, 1, 0); // show url & fn, do it sync

(The comment mentions "sync", however I believe to be synchronous, would need to be using SendMessage(), not PostMessage().)

***Where are the changes that actually kill the timer? Is it done by some means other than KillTimer()? What changes were made in the sep 7, 2006 to accomplish this? (Failed to find inetc in NSIS CVS to explore myself...)

Thanks in advance for the info.

(The crash address appears to be inside of progress_callback(), which appears to only be invoked from the WM_TIMER handling code. As I've tried to re-build the installer locally, obtaining all correct versions (except maybe add-ins, which I apparently can't obtain), and have failed to reproduce the crash, (although I get a display problem possibly from inetc), I'll acknowledge it may indeed be fixed... But I'm interested in knowing how it was addressed/fixed, since I don't see how the timer is being destroyed.)


2 michael.hejwosz: you can find errors in inetc.cpp file.

2 cbexaminr: Thanks for your help. InetLoad/Inetc crashes in NSISdl (no popup) mode found earlier but I supposed sutiation was fixed with Backland help in september. All versions are here http://nsis.sourceforge.net/File:Inetc.zip Unfortunatelly I could not reproduce crash on my comp, so please let me know if you can find 'problem' line in code.
In the today's morning (MSK) version KillTimer was line 953. WM_TIMER handler additionally includes now IsWindow() check for (IMHO weird) situation when window already destroyed, but message loops still delivers events. PostMessage is called at the very beginning of download and should not cause crash, but any way this should be fixed now.


Can someone help me map the error messages found @ http://msdn2.microsoft.com/en-us/library/aa385465.aspx to the following piece of the source code??
enum STATUS_CODES {
ST_OK = 0,
ST_CONNECTING,
ST_DOWNLOAD,
ST_CANCELLED,
ST_URLOPEN,
ST_PAUSE,
ERR_TERMINATED,
ERR_DIALOG,
ERR_INETOPEN,
ERR_URLOPEN,
ERR_TRANSFER,
ERR_FILEOPEN,
ERR_FILEWRITE,
ERR_REGET,
ERR_CONNECT,
ERR_OPENREQUEST,
ERR_SENDREQUEST,
ERR_CRACKURL,
ERR_NOTFOUND,
ERR_THREAD,
ERR_PROXY,
ERR_FORBIDDEN,
ERR_REQUEST,
ERR_SERVER,
ERR_AUTH
};
Thank you in advance,
Mike


Takhir: I've just been trying the latest inetc with NSIS 2.23 and the progress dialog is not being redrawn properly for some reason. This is on Windows 2000 Pro.

Does something need changed for the latest NSIS? I did try rebuilding with the latest exdll header without success.


MinterWute,

I have similar problems with this as well on both XP/2000. I'm still working on a script to reproduce the issue for Takhir.

Its not a bad idea that you attach your script for examination. Please also note Inetc is last updated on 30th of Jan.


Thanks, Backland, script may help. Right now I re-tested latest inetc on my home XP Pro with following script

SetDetailsView hide
inetc::get "http://ineum.narod*****spr_2004.htm" "$EXEDIR\spr4.htm" \
"http://ineum.narod*****spr_2005.htm" "$EXEDIR\spr5.htm"
Pop $0
inetc::get "http://ineum.narod*****spr_2006.htm" "$EXEDIR\spr6.htm"
Pop $2
but could not reproduce redraw issue :(

1) Redraw issue
I and another individual (who I guess is the maintainer of the mingw installer) also have the redraw problem.

You can grab the mingw installer source, and probably see the issue. To the best of my knowledge neither of us have done anything but use a different (latest) inetc - the script code is apparently the same. The url to browse that stuff is:
http://mingw.cvs.sourceforge.net/mingw/MinGW/

The instructions to check it out with command line cvs are at:
http://sourceforge.net/cvs/?group_id=2435

2)earlier reported crash - older version of inetc
I have learned that the crashing version of inetc was the 10 june version. Further research indicates that the crash was occurring at the location where a routine ParentWndProc() should have been (before the pages were released.)

It appears that this routine is no longer part of the current inetc source, and so I will assume that problem is no longer a problem.


OK, redraw is the only problem in current version, so let's find where and why :) OS, IE ver., NSIS ver, latest Inetc, short script reproducing the problem. To test this I have XP Pro and win98 with home dial-up and all OSes and most of connection types in office. Please attach script to post.


http://Jennifer-Lopez-Doing-A-Huge-Black-Man.info


seems the forum is blocking external links, can you guys post your links as plain text (probably by removing the http://www)

google.com


@ Backland, the forum blocks external links that added from new registered users ;)
I bet the blocked link above is just spammers attempt to add their craps in this forum.

If for instance you try to submit an external link, I bet won't be blocked ;)


Thanks Red Wine, testing http://www.google.com

cbexaminr added 2 links just a few posts above, i think those were to the installer which has the redraw issues.


Originally posted by Backland
Thanks Red Wine, testing http://www.google.com

cbexaminr added 2 links just a few posts above, i think those were to the installer which has the redraw issues.
You probably realize that a strong protection from spammers requires some patience from the rest of new registered users ;)

browse mingw installer source tree:
mingw.cvs.sourceforge.net/mingw/MiGW/

to checkout mingw installer source follow instructions at:
sourceforge.net/cvs/?group_id=2435

Sorry it's not "reduced script" - but it's what I can point you toward.

(hope these "links" pass the filtering - funny, I don't think the "preview" showed the links blacked out in original post. There is no www on the items, just h t t p : / / .)


Using SetDetailsView show gives the redraw error for me with your small script. This used to work with previous versions but maybe it's something that I shouldn't have been doing?


SetDetailsView show
inetc::get /RESUME "" "http://downloads.sourceforge.net/devkitpro/libnds-20060719.tar.bz2" "$EXEDIR\libnds-20060719.tar.bz2" /END
Pop $0
MessageBox MB_OK "Download Status: $0"


I tested script from my previous post on the following OSes: Win98 SE (IE5), Win2000 SP2, WinXP Pro SP2, Win2003 SP1, Vista Ultimate Final Release (IE7) - no problems with redraw. Last Inetc Jan 30, 2007. NSIS 2.22. With 'SetDetailsView show' dialog looks ugly (tested on XP), but redraw was correct. May be progress bar smothing in not-XP style would be better.
Edited: I used 2 versions of dotnetfx.exe (20 MB) for LAN downloads.


New Inetc version.
1. /POPUP option now with text (again), /POPUP "HOST_ALIAS" - this allow to hide real URL in popup mode and (if encoded) login/password(!).
2. Transfer speed calculation improved (for paused state mainly).
3. Redirection sample added (I received request for HTTP 301/302, and even added code, but finally found that WinInet does this internally). But redirection prohibitted for https (right now I cannot remember why :) ).


In my tests, this DOES NOT WORK if you don't have .NET installed


I tested last build at home on XP Pro, without .NET and now in office on Win98 and Win2000 (no .NET as well), Inetc works correct on all these comps. If you have problem with all plug-ins (NSISdl, InetLoad, Inetc) it's a good time to check your own script ;)
BTW did you built NSIS from sources?


The .NET install usually includes versions of the MS C Runtime libraries (DLLs).

Is it possible that one of these is getting clobbered and causing the problem? (assuming that the problem is only evident on computer with the .NET framework installed.)

What about the presence of VS 2005, it uses a different version of the MS CRT again (8.0)?

Duncan


I concluded that this problem was only happening in a single PC, there must be something wrong with the .NET libraries (the problem is that even with all the .NET versions unistalled the problem keeps happening...)


Archive: http + ftp download plug-in


Is there a chance to use the "chmod" command if uploading with ftp?
I'm building an installer for a webapp using this great plugin but I couldn't find a way to call chmod remotely :( (beside using a plain ftp-client ;)).


InetLoad steals focus everytime it downloads a new file, even if I minimize the installer, it grabs the focus.

Extremely annoying.

Other than that, InetLoad has saved me :)


ts77
all is possible, only time is a problem :(

empezar
Looks like you are using very old InetLoad version.. This feature was removed more then year ago (sf() function). While some focus tricks still may present in NSISdl display mode. Try to use http://nsis.sourceforge.net/Inetc_plug-in
You can also put more url/file pairs to stack and download all you need in 'single' InetLoad/Inetc session. /NOUNLOAD option in the command line may help as well.


what's the difference between inetc and inetload?


My installer is crashing all over the place with both this and inetc plugin.

I'm downloading about 82 files using this macro:

!macro DownloadDistfile PACKAGE
StrCpy $R0 ${PACKAGE}
${Unless} ${FileExists} "$DISTFILES_PATH\$R0"
FileWrite $DISTLOG "$R0$\r$\n"
inetc::get "$DISTFILES_URL/$R0" "$DISTFILES_PATH\$R0"
Pop $0
${Unless} $0 == "OK"
${If} $0 == "Cancelled"
call .abortDownload
${Else}
DetailPrint "Error downloading: $R0"
${EndIf}
${Else}
DetailPrint "Successfully downloaded: $R0"
${EndUnless}
${Else}
DetailPrint "Skipping: $R0"
${EndUnless}
!macroend


and calling them all like this:

!insertmacro DownloadDistfile package.zip


in 82 different sections.

this is the only code in each section, so this is all the code used from the start of the installer to the end, and it crashes after a while, not always during the same download!


oh and by the way, that focus thing still bothers me. even with the inetc plugin.

I re-tested serial download of 3 12MB files

SetDetailsView hide
inetc::get "http://localhost/IMG_0188.tif" "$EXEDIR\IMG_0188.tif" /END
Pop $0
DetailPrint "Downloading: $0"
inetc::get "http://localhost/IMG_0189.tif" "$EXEDIR\IMG_0189.tif" /END
Pop $1
DetailPrint "Downloading: $1"
inetc::get "http://localhost/IMG_0190.tif" "$EXEDIR\IMG_0190.tif" /END
Pop $2
DetailPrint "Downloading: $2"
MessageBox MB_OK "Download Status: $0, $1, $2"

with minimized installer, all the time I had notepad opened and it never losed focus during download. So bothering
problem not reproduces with my Apache.
Crashes also not happened. I never tested 82 sections, this may be NSIS problem as well. Do you see any minimum sections number when the problem appear?
Can you test your script with "inetc::get /NOUNLOAD ... /END"? this should decrease number of dll loads/unloads.

thanks, that solved it!

also, forget what I said about the focus thing - i was testing with an old installer :D my bad.


Hi,

is it possible to add a function to list files in a ftp directory?

In fact, I need to download the list of existing files (with their dates) in a specific FTP directory.
After that, I will display this list to the user so he can choose what file he wants to download.

Is it possible to add a new method InetLoad::list?


is it possible to pause downloading? say if a user presses Cancel, I want to display "Are you sure?" and have the download PAUSE. if they then press NO, the download should resume. I've only succeeded in making the download re-download, but that is not very good when we're talking 100MB+ files :)


Not in current version. BTW if plug-in loses connection it re-gets file from the current position, on permanent problems it displays customizable /resume message and also correctly continue download, but on Cancel (may be disabled) it even deletes local file.


one more question. is it possible to display different messages on the same /BANNER download window?

e.g. "Downloading file 1 of 3" -> 2 of 3 -> 3 of 3

that is without it popping up another window?

it's annoying when you have to download a lot of files during initialization and each file has its own window, as moving one window will only result in the next popping back up in the middle of the screen.


I've got a problem with one of my ftp servers.
This server, hosted by infomaniak.ch returns a 404 when I try to get a file via FTP.

If I try to upload a file via FTP on this server, it works fine
If I try to get the same file but with a HTTP get, it works fine.
If I try to get a file from any other server than this one, it works fine.
Every other FTP client can download from this server without error (even Internet Explorer)

Is there a way to find why I get a 404 from this server if I use a FTP get with inetc?


empezar
You can add as many url/file pairs to the command line as you want. To keep working with short command line use push to stack in the reverse order:

Push /end
Push filen
Push urln
...
Push file1
Push url1
inetc::get
This way plugin not re-creates dialog and not center it on every new file. But this is not compatible with various banner texts.
fabiochelly
404 is common http status code, please check ftp:// at the beginning of command line http://en.wikipedia.org/wiki/List_of...r_return_codes . Also for full path (from / ) use ftp://server//path/file, but for current user home dir use single slash before path.

I checked my host but everything seems correct:
host: ftp://login:password@chelly.net/bp.exe

I always get a 404! I really think that my problem comes from the fact that this server is configured differently.
I think there is a problem with your plugin if used with some rare servers or a specific configuration


Hi Takhir,

I just downloaded the latest version of your InetC plugin and noticed that there are more dependencies than before.

You now depend on msvcrt.dll (you did only depend on comctl32.dll and wininet.dll before).


No. I had a lot of msvcrt dependencies earlier, but removed 80% in last releases. Finally this is not a problem - plug-ins depend on wininet.dll, but any system with wininet has msvcrt.dll
And I've sent pm to fabiochelly


Does this plugin work if there is an @ character in the username for an FTP server? I seem to get a URL parts error.

Thanks.


If InternetCrackUrl (used in plug-in to get url parts)reports url error - no, not supported. The only @ as password-host separator.


I discovered, this can be resolved by susbtituting the first "@" character with "%40"


Just curious:
A few posts back, fabiochelly asked:

is it possible to add a function to list files in a ftp directory?
Does this functionality exist in the current version? If so, how do you use it? If not, any chance it could be added?

Does this functionality exist in the current version? If so, how do you use it? If not, any chance it could be added?
1. No.
2. See 1.
3. inetc/inetload looks solid in current implementation, ftp/http, get/put/post - all the functions use 90% of common code (even write and read implemented in the same loop). ftp ls stays a bit apart and this is why I don't want to include it to these plug-ins. IMHO better way is to write a normal ftp plug-in. I even have a code of the ftp backup client (Explorer style, mirroring, files versioning, queues, file migration status for disk cache and so on..) I wrote few years ago for ADIC, but I cannot share this code and have time for small 'free' tasks only now :(

Sounds fair enough. Thanks, Takhir! :)


Hi People,

I seem to have a problem downloading text files via ftp. Some new line returns are missing. Should there be an argument to set the ftp to binary or ascii? If so, is there a way I can do this?

Thanks in advance.


Has anybody else found this?

If I put a text file online via ftp. Say the following:

"hello

world

end"

The InetLoad plug-in will download the file without the line returns, as:

"hello
world
end"


layout
NSISdl used the installer's "Cancel" button, and also expanded the progress bar to be the same size as the installation progress bar (in Modern UI mode). Is there a way to get inetc to act the same? (/NOCANCEL just removes the extra cancel button and does not enable the built-in button).


Just from vacations :)
ART_Adventures change FTP_TRANSFER_TYPE_ASCII to FTP_TRANSFER_TYPE_BINARY in source code and rebuild plug-in. I cannot remember why ASCII was used :( But till now I had not problems with binary files download. Nevertheless I'll update wiki to fix your situation (after some tests).
NeoAlus not in options - code correction required. Inetc inserts a small dialog with progress bar to NSIS window (3-rd level dialog), so this dilaog and it's controls to be resized. Looks reasonable, I'll try to add this feature soon.
May be in weekend. A lot of other work now.


1. Plug-in uses ASCII mode for file size requests only (ftp), file download is always binary, so please check your server settings. I tested ASCII download from Wftpd.exe server and everything was correct.
2. Extra Cancel button should exists by design. Second progress bar and text above it may be resized (see attached image), but I don't like this design so I'll leave plug-in as it is now. If you want I can send you inetc.cpp code with resizing I wrote today.


Is this plugin able to calculate the total file size and thus showing the total download time correctly? It works in 'batch' mode, but every file is download separately and therefore the total download time is unknown, if multiple files are requested. (at last if http download is used.)


Some builds threw out a "Url Parts Error" at the end of the downloading but the file is successfully downloaded and not deleted. What's wrong with it?


acrunner: Your stack contains other items, use /END at the end of command line. Otherwise plug-in reads stack till end or first error in URL - File pair.

SEK_Blackhawk: no this option. You can show one of NSIS banners with progress bar showing size or number of files downloaded progress (inetc may be in the silent mode this case). To get files sizes from server use 'head' request. This banner worked correct http://nsis.sourceforge.net/Nxs_plug-in


There really is a problem with Inetload FTP downloads and a recent version of the ProFTPD server. I also get 404 errors, even though the file exists. Try for example to download any file from ftp://ftp.lyx.org.


Thanks, Joost,
I could reproduce situation and found 'why' - see attached screenshot. The same answer in console: PHP Code:


ftp>literalSIZEapache-ant-1.7.0-bin.tar.bz2.md5
550SIZE
:Operationnotpermitted

Server not 'eats' SIZE request and plug-in re-interprets 550 as 'file not found'. BTW 'ls -l' not gives extended info on this server as well. Finally I can make ftp working without file size, but IE displays this, so it is possible. Any Ideas?
Edited after short googling: BTW ProFTPD 550 on SIZE has a great history :) http://www.google*****search?hl=ru&q=...roblem+550&lr= And SIZE request fails even with FTP_TRANSFER_TYPE_BINARY for control connection.

FileZilla is able to display the file sizes, so they must be in some directory listing.


OK, both inetc & inetload allow FTP download now even is server rejects SIZE request, but progress bar functionality will be unavailable while file size is unknown (the same happen with chunked http replies). And confusing '404' shold not appear any more.


inetload crash on windows Vista
When I run setup on windows vista, sometimes it runs fine but sometimes it crashes.
Every time crash occurs while downloading. I am using InetLoad for downloading through following command:

InetLoad::load /TRANSLATE "Downloading %s" "Connecting ..." second minute hour s "%dkB (%d%%) of %dkB @ %d.%01dkB/s" "(%d %s%s remaining)" \
"192.168.1.204/xyz.exe" "$INSTDIR\xyz.exe" /END

Any help will be appreciated.


This happen sometimes in NSISdl mode you currently use. Happen in the part of code I took from NSISdl sources :) The best way is to use inetc plug-in where this part was fully re-worked. inetc::get .... Or popup/banner mode of InetLoad. http://nsis.sourceforge.net/Inetc_plug-in


Section "Dummy Section" SecDummy

# parameters: URL local_file [reget_attempts [pause_sec]]
InetLoad::load "http://dl.zvuki*****6306/mp3/1.mp3" "$EXEDIR\pavarotti.mp3" 3 10
Pop $0 # return value - exit code
MessageBox MB_OK "HTTP Download Status: $0"

SectionEnd
I don't like MessageBox show "HTTP Download Status: OK" when i completed Download
i like MessageBox show "HTTP Download Status: over"

how can i do it show over

is there a way of cancelling the installer by pressing the [x] button on the inetc download window during .onInit?

what "termination code" does inetc provide when you press that [x] button, if any (again, during .onInit with /banner mode)? I've tried "Cancelled" and "Terminated", but I get seemingly random results, and they don't come right away, but after about 2 seconds, which seems a bit buggy to me.

this is the code I use:

GetTempFileName $NQUAKE_INI

Start:
inetc::get /NOUNLOAD /CAPTION "Initializing..." /BANNER "nQuake is initializing, please wait..." /TIMEOUT 5000 "${INSTALLER_URL}/nquake.ini" $NQUAKE_INI /END
Pop $0
${Unless} $0 == "OK"
${If} $0 == "Terminated"
MessageBox MB_OK|MB_ICONEXCLAMATION "Installation aborted."
Abort
${Else}
${Unless} $RETRIES > 0
MessageBox MB_YESNO|MB_ICONEXCLAMATION "Are you trying to install nQuake offline?" IDNO Online
StrCpy $OFFLINE 1
Goto InitEnd
${EndUnless}
Online:
${Unless} $RETRIES == 2
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Could not download nquake.ini." IDCANCEL Cancel
IntOp $RETRIES $RETRIES + 1
Goto Start
${EndUnless}
MessageBox MB_OK|MB_ICONEXCLAMATION "Could not download nquake.ini. Please try again later."
Cancel:
Abort
${EndIf}
${EndUnless}

Plug-in should return "Cancelled" string if user pressed this button. Download thread exit may require some time if it waits for data from socket.


okay.

seems to work, though sometimes i still get the "could not download" message instead of "installation aborted". i can live with that though.


Archive: http + ftp download plug-in


after further testing, I can say that I only get the "installation aborted" message when the download actually fails. I tried changing the download url to something that doesn't exist, and now everytime I press the [x] button, I get the wrong message ("are you trying to install nquake offline?").

so apparently, inetc only returns "Cancelled" if the download was successful AND cancelled?


URL Parts Error
My installer works fine on my machine but as soon as i run it on another machine it seems to download and at the end get a URL Parts error. i am using inetc get command with the /END prefixed and still getting it.

All i am downloading is the ASP.NET Ajax framework with the following command

inetc::get /caption "Downloading AJAX ASP.NET Framework 1.0" /canceltext "Cancel Download" "http://download.microsoft.com/download/5/4/6/5462bcbd-e738-45fa-84ca-fa02b0c4e1c2/ASPAJAXExtSetup.msi" "$INSTDIR\ajax.msi" /TIMEOUT 5000 /END

I do not know why it works on one and the other machine gets the URL Parts Error, anyone mind to shed some light on this? :)

TIA


Does $INSTDIR exist?

Stu


Move /TIMEOUT 5000 to the beginning of command line.


aha! That did the trick!
Hmm, the fact that it worked on one machine and didn't in the other really did not strike me as writing the command erroneously :P


What is the OS on the two machines?


InetLoad frequently crashes on Windows Vista while downloading from an FTP server. Did you test the Vista compatibility?


I tested InetLoad on Vista. Do you know any addition requirements for NSIS plug-ins on this OS? And please attach test script if you can reproduce crash. Might be good to compare situation with Inetc that not includes 'crashable' NSISdl code fragment. Thanks.


InetLoad is great!
I have a problem though: I'm using InetLoad to post installation status to a server.

When I call it before the first custom page (MUI) it makes the installer run in the background.

This is really bad cause when a user downloads my installation and the installer doesn't go to the front of the page, the user wouldn't know it's running.

Any way to solve this?


If new process (installer) creates any window during a short period of time, OS gives this window focus and sets it foreground. In your situation window appear too late (silent http request delay from .oninit function?). If you don't want to use InetLoad popup/banner, use one of NSIS banner plug-ins to catch foreground position. You can also try to use SetForegroundWindow call to move installer foreground, but this is not efficient in most OSes (InetLoad do this in silent mode for some reasons), see example in the attached script how to do this.


Takhir, thanks for you quick response.

Tried your code - Now after the post the installer flickers (windows xp) on the taskbar. No way to make the posting not steal focus?


The only good way I know is to create new window when process starts. Try to use InetLoad' own (/popup, /banner) or another banner.
Yes, on XP and later SetForeground causes flickering only.


would it be possible to get some speed information on the /banner window?

i want to have customized download texts (i.e. not "downloading <filename>" but rather "downloading <file description"), but /banner makes the download speed text go away :(


Sorry, I am overloaded with urgent job, but for now you can create your version of plug-in with this output in the /banner window static field by copying code from /popup output timer function (C experience required).


Small suggestion. Use the INTERNET_FLAG_NO_CACHE_WRITE flag in HttpOpenRequest() to disable writing in the IE cache. At the moment all downloaded files goes into to the cache as well.

I tried this my self and it seems to work so far. :)


Thanks! I'll add this to the next release.
BTW I prepared an dcompilled but not tested Unicode (TCHAR) version (because not sure that NSIS Unicode package will not damage current ANSI version), so if anybody want to test it - please send me private message (it's in Account on the page top).


Originally posted by Takhir
Thanks! I'll add this to the next release.
There seems to be a problem with the resume ability while INTERNET_FLAG_NO_CACHE_WRITE is used. The MSDN page for InternetSetFilePointer() function state that...
...subsequent calls to InternetReadFile might block or return pending if the data is not available from the cache and the server does not support random access.
On my tests resume didnt work on any of the servers that I tried. Either those servers didn't support "random access" (whatever that means :weird: ) or resume won't work at all while INTERNET_FLAG_NO_CACHE_WRITE is used. So I think it's better leave the cache writing on while resume is used.

:o From the InternetSetFilePointer() MSDN page "... This handle must not have been created with the INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_NO_CACHE_WRITE value set."

So using INTERNET_FLAG_NO_CACHE_WRITE breaks the resume for sure.

I realized that there's a small bug in the Inetc code. This statement is always true because InternetSetFilePointer() return type is DWORD.

if(!InternetSetFilePointer(hFile, cnt, NULL, FILE_BEGIN, 0))

You should use something like this.
if((int)InternetSetFilePointer(hFile, cnt, NULL, FILE_BEGIN, 0) == -1)

--

The IE cache writing still bothered me so I made a little research for alternative methods and I found this article.
http://www.clevercomponents.com/arti...5/resuming.asp

I implemented the range request method described in there to Inetc code. It works without the cache, but probably isn't reliable as the InternetSetFilePointer() method.

Thank you very much {_trueparuex^}
I updated both inetc & inetload plug-ins. Also new feature in inetc: /question cancel_text (was requested here)
About no_cache_write using 'range request' - interesting idea for big files (like night movie downloads). Let's check reliability and if OK we'll add your code to inetc. Or you can write new multuthreaded super-fast downloader ;)


Originally posted by Takhir
Thank you very much {_trueparuex^}
I updated both inetc & inetload plug-ins. Also new feature in inetc: /question cancel_text (was requested here)
About no_cache_write using 'range request' - interesting idea for big files (like night movie downloads). Let's check reliability and if OK we'll add your code to inetc. Or you can write new multuthreaded super-fast downloader ;)
No problem :)

...1500 megawatt Aperture Science heavy-duty super-threaded super loader. :eek: Seriously that's not a bad idea at all.


At least there shouldn't any difference on what servers the resume methods work...
http://support.microsoft.com/kb/168408

But InternetSetFilePointer() definitely is more flexible and handles exceptions way better.

There was bug in the content length / accept ranges check in my last file. So here's a new one.


I think there is a bug in inetc::put. When I try to upload a file, the http header content-length is always 0. Here's an example:

======= Start =======
PUT / HTTP/1.1
Content-Type: octet-stream
Content-Length: 0
User-Agent: NSIS_Inetc (Mozilla)
Host: XXXXXXXX.de:8812
Connection: Keep-Alive
Cache-Control: no-cache

line1
line2
======= End =======

In the NSIS script I use this line:

inetc::put "http://docstore.interchange.de:8812/" "$EXEDIR\testfile" /END

When I upload the file with curl (curl -T testfile http://XXXXXXXX.de:8812) everything works as expected:

======= Start =======
PUT /testfile HTTP/1.1
User-Agent: curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8g zlib/1.2.3 libssh2/0.15-CVS
Host: XXXXXXXX.de:8812
Accept: */*
Content-Length: 16
Expect: 100-continue

line1
line2
======= End =======

On XXXXXXXX.de:8812 runs netcat (nc -l -p 8812) which does nothing more than capturing everything that comes in on port 8812. Inetc and curl connect directly to the server (no proxies).


Is this a know problem? Unfortunately, I don't have Visual Studio available, so I can't dive in the code myself. But I'd love to help debugging it on the server side if needed.


Thanks, janekschwarz. Bug was added in the Jan. 30, 2007 revision. Fixed now, please update your files.


Thank you for the quick answer. I'll download the new version and report back.


Takhir, thanks again for the fix. It works.

Another question: Does http authentication work with inetc::put? I tried something simple (http://user:passwd@XXXXXXXX.de/puttest/put.php) and always get an 401 error back. Curl authenticates successfully.


Thanks, janekschwarz! I could reproduce this issue, probably this configuration was not tested earlier. Short googling gave me few similar questions, but no answers yet. Server accepts PUT request, receives file, but returns 401 in EndRequest() status header. Download from the same protected folder (.htaccess overridden) works correct. Any ideas?


I did an experiment. Authentication works if I set the Authorization header my self:

inetc::put /HEADER "Authorization: Basic PXVzZXI6cGFzc3dk" "http://XXXXXXXX.de/puttest/put.php" "$EXEDIR\testfile" /END

Maybe the trick is to send the Authorization headers preemptively.


And thank you again, janekschwarz!
I tested patch (internal base64 login:passwd encoding) and it worked fine. When (and if) sourceforge will work again I'll put new zip to server.


Hi, thank you for the fix.

I hate to admit it, but I found another problem: inetc::put through an authenticating proxy does not work. It gives up right after receiving the 407 status code from the proxy and does not ask for proxy credentials (example.nsi contained in the zip file does, so it works in principle).

Any ideas?


Unicode
I attached unicode version on inetc plug-in to this post - worked correct during my (short) testing. Wiki version has the same TCHAR decoration, so the only difference with archive code is path to exdll.h. I'll convert project to VS 2005 with additional Unicode configurations and put to wiki later (after some tests, and I hope you will help me). Version with log prints (for debugging) is temporary available here http://ineum.narod*****inetc.htm
Have fun :)


By the way there is a slight issue when using inetc on the install files page. If you haven't clicked the show details button, then everything is fine (inetc disables it, fine). If however, you do click the show details button before downloading, inetc shows over the log window without hiding it.

Be nice if this code could go in the plug-in but this is how to sort it in NSIS script:


!macro DownloadPre
FindWindow $R0 `#32770` `` $HWNDPARENT
GetDlgItem $R0 $R0 1016
System::Call user32::IsWindowVisible(iR0)i.R1
StrCmp $R1 0 +2
ShowWindow $R0 ${SW_HIDE}
!macroend
!define DownloadPre `!insertmacro DownloadPre`

!macro DownloadPost
StrCmp $R1 0 +2
ShowWindow $R0 ${SW_SHOW}
!macroend
!define DownloadPost `!insertmacro DownloadPost`

...

${DownloadPre}
inetc::get ...
${DownloadPost}

Just make sure you don't touch the $R0 and $R1 variables between DownloadPre and DownloadPost.

Stu

Thanks, Stu, I'll try to add this feature to next release. Is 1016 unique value for this page-control?
This morning I uploaded inetc version with (I hope) finally fixed PUT issue if proxy or HTTP server authorization required (many thanks to janekschwarz). Problem was in proxy/server auth request that came back after all data were already sent (and progress bar reached right border). New version for HTTP PUT first tests connection using OPTIONS request. The only remaining 'difficult' situation is PUT to HTTPS if proxy/server authorization data to be requested from user (in password/login dialog) because OPTIONS request to HTTPS failed in my tests.
http://nsis.sourceforge.net/Inetc_plug-in


Yes it is the id for the list view control.

Stu


Also, is it just me or does it not re-enable the show details button?

Stu


Inetc restores original button style after transfer complited. May be nothing to 'show' in your sample? ;)


If i use Inetc plugin in .OnInit function, installer never gets focus when launched.
Ex :


!include "MUI2.nsh"
Name "test"
OutFile "Install.exe"
RequestExecutionLevel Admin

!InsertMacro MUI_PAGE_License $(license)
!InsertMacro MUI_PAGE_INSTFILES
Function .onInit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

HTTP:
InetC::Get /SILENT "http://www.google.com" "$TEMP\bug.txt" /END
Pop $0
StrCmp $0 "OK" OK
ERR:
messagebox mb_ok "Error : $0"
OK:

FunctionEnd
Section
SectionEnd


Another problem with close button :

I have a script with AutoClose = True and InetC command in .OnInstSuccess function

If a user click on the button before the page desappears then the execution of the script jump to a random location (always the same though).

Any help ?
thx

1. You can find related discussion on page 5 of this thread.
2. Any plug-in require installer running, may not work when on the exit step, so it's not a good idea to run inetc in .OnInstSuccess.


Is this a bug or am i doing something wrong?

I'm trying to download a file from https using authentication, the username dialog comes up fine and works as expected when wrong and right usernames are entered.

However is one clicks cancel on that dialog, inetc downloads the http error report and sets status to OK. Is there a way to detect if/when this happens?

Vytautas


This is a bug. InternetErrorDlg() returns ERROR_SUCCESS 0 on Cancel click (I hoped this to be ERROR_CANCELLED 1223 as MSDN declares). Thanks, Vytautas, I'll put updated to server version as soon as sourceforge will be up (with 2 other small changes).


Thank you, thats much better now :)


Archive: http + ftp download plug-in


OK, Found another issue, when authentication is used even if the correct info is provided it displays canceled first time, then when retrying to authenticate it works OK.

here is the sample code used

downloadcrmsi:
StrCpy $CR_Install "$INSTDIR\CRRedist2005_x86.msi"
inetc::get /NOCANCEL "https://xyz.com/CRRedist2005_x86.msi" "$INSTDIR\CRRedist2005_x86.msi"
Pop $1
Dumpstate::debug
${If} $1 == "OK"
Goto installcr
${Else}
MessageBox MB_RETRYCANCEL "Download Failed!" IDRETRY downloadcrmsi
Abort "Crystal Reports Runtime 10.2 Download Failed"
${EndIf}

as can be seen even when correct login is specified i get a download failed box come up, when retry is pressed it connect straight away without asking for authentication

If it better that if the plugins may support multilanguage. I'm Chinese, some plugins provide a header file to define multilanguge, some not. If all plugins support multilanguage, that is better.


Vytautas: thanks again! I hope this is fixed now..
jiake: yes, this would be better, but for now you can use /TRANSLATE option for /POPUP and NSISdl mode, /BANNER mode also has text parameters. Use LangString if you want to support few langs in your installer.


Thank you Takhir, that indeed seems to have fixed this problem.


Currently all 3xx errors are treated as redirection. You should add and exception for "304 not modified" status. Users may send "If-None-Match" or "If-Modified-Since" header to check if the file has changed on the server. :)


I use Inetc's /RESUME option to display a message when Inetc is unable to download a file. This is useful for users who are still using dial-up connections.

This /RESUME feature no longer works properly. If there is no connection to the internet the plugin now creates an empty file and does not return the "SendRequest Error". My installer then tries to use the empty file and fails because the file is zero bytes long.

The Inetc plugin dated 1 April 2008 is OK - if there is no connection to the internet it returns the "SendRequest Error".

The Inetc plugins dated 30 April, 4 May and 20 May 2008 do not return the "SendRequest Error" if the internet connection is down.


Not reproduces. I unplugged LAN cable (ethernet) and resume popup appears as expected. Exit status is SendRequestError.

Inetc::get /RESUME "" "http://kolobok/sfu_3.exe" "$EXEDIR\sfu.exe"
"$EXEDIR\u.jpg"
Pop $0
MessageBox MB_OK "Download Status: $0"
May 20 version.

The new Inetc plugin, dated 21 May 2008, fixes the problem so my installer now works properly.

Thank you for fixing this problem so quickly.


/SILENT doesn't work
Hi,

Take a look at code below.


Name "test"
OutFile "test.exe"

;SilentInstall silent

!define UpdateConfigFile "update.ini"
!define UpdateURL "http://www.daisywheel.kiev.ua" ;


;---------------------------------------------------------------------------------
; Sections
;---------------------------------------------------------------------------------
Section

loop:

MessageBox MB_OK "hi!"

InetLoad::load /SILENT "${UpdateURL}/${UpdateConfigFile}" "$TEMP\${UpdateConfigFile}"
;InetLoad::load "${UpdateURL}/${UpdateConfigFile}" "$TEMP\${UpdateConfigFile}"
Pop $0
MessageBox MB_OK $0

StrCmp $0 "OK" 0 loop


SectionEnd


When I add /SILENT to InetLoad::load call I get not "OK" response but "connecting" and file is not loaded.

Is it a bug or do I misinterpret something?

tnx,
Roman

Please not /silent option description:
[/SILENT TEXT2DISPLAY]
SILENT
Key hides plug-in' output (both popup dialog and embedded progress bar). Sets TEXT2DISPLAY to 1006 control, if /silent "" - displays "InetLoad plug-in" default. Not required if 'SilentInstall silent' mode was defined in script (NSIS 2.03 option).


Very nice POPUP dialog. I wonder if it is possible to embed it somehow into main window?


This is NOT implemented in current version. But if you know C, you can change parent window for POPUP here

if((hDlg = CreateDialog(g_hInstance,
MAKEINTRESOURCE(szBanner ? IDD_DIALOG2 : (popup ? IDD_DIALOG1 : IDD_DIALOG3)),
(popup ? hwndParent : childwnd), dlgProc)) != NULL)
to
if((hDlg = CreateDialog(g_hInstance,
MAKEINTRESOURCE(szBanner ? IDD_DIALOG2 : (popup ? IDD_DIALOG1 : IDD_DIALOG3)),
(szBanner ? hwndParent : childwnd), dlgProc)) != NULL)
and to change POPUP dialog properties to 'child' and 'no frame'. May be some other small changes require. After this plug-in shuld work with embedded POPUP window. ;)

Thanks, but I'll better stick to official version. =)

This /POPUP option caused some unpleasant moments with upgrading an old installer. New obligatory /POPUP parameter caused downloads to fail with "URL Parts Error" after the upgrade. New parameter was omitted in old installers and new inetc still consumed the following option as an argument making the command wrong.

Now if /POPUP "" is specified, the URL field in popup window is empty while it should be not according to docs. I tested this on bundled Example.nsi Can anybody confirm?

BTW, it would be nice to have this URL clickable or copyable for diagnosis of download problems.

P.S. To track the issue the whole inetc history was recreated at Launchpad. https://code.launchpad.net/~techtonik/+junk/inetc


Thanks, ********, I updated inetc.zip, now it displays URL if "". This was lost at least half of year ago :(
To make URL copyable I should change control type from 'static' to 'edit'. To keep GUI integrity this should be done for all controls on this dialog, tested... New option required for 'clickable' URL.. So.. good idea, may be with next big changes :)
I agree, parameters changes (/POPUP with text value) is not good for support, but this happen sometimes...


I am trying to get your example_unicode.nsi to work with the NSIS 2.38.-1 Unicode, but it does not work :(

I am using your original example_unicode.nsi from the latest .zip.

The details window says

Download Status: 剕⁌慐瑲⁳牅潲r, 剕⁌慐瑲⁳牅潲r, 剕⁌慐瑲⁳牅潲r
Completed


"Download failed: OK" is result of script.
I'm close to getting this implemented, but I keep running into a roadblock at the point at which I need to download the file and write it to the TEMP directory. The script successfully creates the 'receiving' file (jre-6u7-win...exe) that the stream is to be written to, but I am lost as to what happens after that.

The error message I see is "Download failed: OK"

Here is the snippet of code where it fails:

<code> DownloadJRE:
; Call ElevateToAdmin
MessageBox MB_ICONINFORMATION "${PRODUCT_NAME} uses Java Runtime Environment ${JRE_VERSION}, it will now be downloaded and installed."
StrCpy $2 "$TEMP\jre-6u7-windows-i586-p.exe"
inetc::get /PROXY www-proxy.boeing.com:31060 /TIMEOUT=30000 ${JRE_URL} $2 /END
;InetLoad::load /POPUP "JRE downloading..." /TIMEOUT=30000 ${JRE_URL} $2 /END
;nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2
Pop $R0 ;Get the return value
StrCmp $R0 "Download successful." +3
MessageBox MB_ICONSTOP "Download failed: $R0"
Abort
ExecWait $2
Delete $2

ReadRegStr $R1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
ReadRegStr $R0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$R1" "JavaHome"
StrCpy $R0 "$R0\bin\${JAVAEXE}"
IfFileExists $R0 0 GoodLuck
Call CheckJREVersion
IfErrors GoodLuck JreFound

; 4) wishing you good luck
GoodLuck:
StrCpy $R0 "${JAVAEXE}"
; MessageBox MB_ICONSTOP "Cannot find appropriate Java Runtime Environment."
; Abort </code>

Thank you for any assistance you can provide.


StrCmp $R0 OK +3


Privet

I am downloading a 150 MB file. Everything works amazingly well in Windows XP, but it fails miserably in Windows Vista.

My code:
RequestExecutionLevel admin
InetLoad::load /POPUP " " "http://url.com/file.exe" "$INSTDIR\file.exe"

Any ideas?


Vista Home Premium with updates, Kaspersky Internet Security 2009, 69 MB file download from Apache 2.2

Name "InetClient Test"
OutFile "inetc.exe"
RequestExecutionLevel admin

!include "MUI.nsh"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Section "Dummy Section" SecDummy

SetDetailsView hide
inetc::get /popup " " "http://localhost/css/ltrm2_wwefg_win.exe" "$EXEDIR\light_room.exe" /end
Pop $0
MessageBox MB_OK "Download Status: $0"

SectionEnd
works_for_me. NSIS 2.40 exe 1.5 MB download from sourceforge.net is OK too. May be this is your Vista security limitations?

I was confused as I was using InetLoad and you are supporting inetc here :) Can you add a note that inetc is a more up to date version than InetLoad on the InetLoad wiki? I wouldn't have used it in the first place.

I have made some custom modifications to the C code, and it seems that it's some of those that break under Vista for one reason or another. I tested the vanilla version, and there is no problem, so you can disregard my previous message altogether.


Hi,

as i wrote above i cannot get it to work with a NSIS Unicode Build (2.38-1) any Ideas on this? I am building the inetc.exe with the "example_unicode.nsi" from the Zip.

Does anyone else get this to run?

Thanks.


Last time I've built and included inetcu.dll to Wiki package in February 2008... Attached version was created from latest (Sept. 1, 2008) sources. Unfortunatelly on new comp I have not NSIS Unicode installed, so attached Unicode plug-in variant is not tested...


Works like a charm, thanks a lot :)


Does plugin support FTP-over-HTTP proxy servers?

Thanks a lot


Does plugin support FTP-over-HTTP proxy servers?
Not worked in my test (Connection Error). Plugin should use IE proxy settings by default, but I also tested manual proxy settings - not helps. Windows XP CLI ftp client not worked as well. Browsers are OK, so probably WinInet.dll has less ftp functionality then IE or Mozilla.

I tested with Windows 7 and IE8 w/ XP SP3 and at least inetc::get worked fine.

Just thought I'd report.


when used in the .onInit function, inetc prevents the main installer window from being shown in the forefront.

I guess that this is because you create a dialog, even when the /silent option is passed, and that dialog must become the forefront one (even when displayed as SW_HIDE), and then when the installer shows its dialog, it can't bring it to front.

Any way this could get fixed?


Just found an interesting problem using this plugin on a machine. I am still doing tests but here's the situation:

Running the installer in the place of userinit.exe (meaning it runs before userinit.exe is executed and therefore before explorer.exe).

The plugin downloads the Adobe Flash Player ActiveX plugin for Internet Explorer. It gets to 100% and then the installer freezes. Soon after this the entire machine freezes, first being the task bar followed by the desktop and then any other programs running (for example, LogMeIn also stops functioning).

Hopefully it is this machine that is the problem, but either way do you see any possible reasons for this?

Edit: It was happening during silent install as well but I have only found it is the plugin by running in non silent mode - or rather I assume it is the plugin as it still shows the downloading progress bar at 100%.

Stu


gudy: thanks, but this is very long story of attempts to keep installer foreground in such situations. BTW the same problem has place with few other plug-ins. I can test fixes if you have ideas. Might be good to have solution for both silent and not silent modes.
Afrow: I am not realy understand when plug-in was running. If we are talking about calling this dll from Windows service (i.e. from SESSION, not from Desktop) - I never tested ths mode. I only can say that task bar and desktop are Windows Explorer subsystems, they freezes when Explorer is (almost) died.


It appears to be a problem with the machine so sorry about that!

Stu


Hi there,

Do you have any experience with checking the hostname inside the CN field of a server certificate?

One of the checks that I need to have is that the server name inside the certificate ends in the correct domain. Of course, this would be in addition to the checks that wininet would do for you, which is that the name of the server connected to is the same as that in the CN field of the cert from the server, and that the cert is issued by a trusted authority.

I'm guessing that the easiest way to do this is to probably call InternetQueryOption just after InternetConnect, with the parameter INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT , which would return a INTERNET_CERTIFICATE_INFO struct. The lpszSubjectInfo member should contain the information I need, once I figure out how to tear it apart. What do you think?

I was thinking that the domain that I'd be checking for would be passed in as a parameter.

What would be the process for having this submitted back to you so that it could be included in the standard release?


This is first request for server certificate fields verification, IMHO no sence to overload plug-in with seldom used features. But you can create your own version of plug-in with this feature and even add it to NSIS wiki ;)


Hi,

is there a way, or will there be a way, to start the download in async. mode.

Right now, i copy wget and start it async. with ExecDos,
but using InetLoad would look much better.


Right now - no :(.


Is there an updated unicode build, you can probably include both call the unicode one 'inetcu.dll' or something.


McAfee trojan alert for inetload.dll
Has anyone else had any problems with McAfee Virus scanning whining about the Inetload DLL having a 'generic!bg.hpk' virus?
It's deleted my inetload.dll and broke my build but has been working for ages up until now. Perhaps McAfee has updated the virus definitions and only picked up on this today.


garygumdrops: There are many posts about such problems. Search before you post, please.


Please report false positives: http://www.mcafee.com/us/threat_cent...spute_form.asp

Look at: http://nsis.sourceforge.net/NSIS_False_Positives


Downloading JDK
Hi all,

I have some troubles downloading JRE and JDK from Sun's homepage.

I simply use the following code:


inetc::get $0 "$TEMP\Setup.exe" /END
Pop $0 # return value = exit code, "OK" if OK
DetailPrint "Download result = $0"


where $0 contains the url.

Now this only works with the JRE online installer[1], trying to download JRE offline[2] or JDK offline[3] installer does the following:
The download finishes in just a couple of seconds (although the files aren't that small), exit code is "OK", but the download is obviously not complete.
If I add the /POPUP option, I get a Connection Error.

Can anybody reproduce this and think of an sulotion?

I really like the plugin, please kept up that good work!

Thanks in advance,
morty

Um, how do I add URL correctly?

[1] JRE online
[2] JRE offline

[3] JDK offline

Re: Downloading JDK
I tested following script with first of your URLs http://javadl.sun.com/webapps/downlo...BundleId=33787

Name "InetClient GET Test"
OutFile "get.exe"

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

Section "Dummy Section" SecDummy

SetDetailsView hide

; single file, NSISdl-style embedded progress bar with specific cancel button text
inetc::get /canceltext "interrupt!" "http://javadl.sun.com/webapps/download/AutoDL?BundleId=33787" "$EXEDIR\jre.exe" /end
Pop $1

MessageBox MB_OK "Download Status: $1"
SectionEnd


;--------------------------------
;Installer Functions

Function .onInit

FunctionEnd
and found 698kB file as a result. When started this exe displays JRE installation window (see attachment).
Please check /POPUP mandatory parameters in your script.

Archive: http + ftp download plug-in


Hi Takhir,

thanks for the quick reply. The first URL works with my script too, it is the second and third URL that don't work.


Sorry :)
Please test last link (https) in a browser - my Mozilla displays "Download Java SE Development Kit 6u17 for Solaris x86, Multi-language" page, not exe. The same I get from inetc - 28 kB file, when renamed it is viewable in borwser as well.


Still got some problems using ftp::put

When using:
Works:
inetc::put /CAPTION "service pack upload" "ftp://user:pass@192.168.0.150:8021/5mb.bin" "c:\Dell\5mb.bin"

Fails:
inetc::put /CAPTION "service pack upload" "ftp://user:pass@192.168.0.150:8021/Application/5mb.bin" "c:\Dell\5mb.bin"

The only difference is the Directory on the FTP server. The directory exists. What else should I use?


Please note that most of ftp servers work with paths relative to logged user home dir.


I know. But logging on with any other FTP client is placed in to root. Local FTP server that's running on a device with WinCE. For testing purposes it's running localy.
By running the working version it's placed in the root correctly. And I'm really sure that the directory exists :)


To be sure it goes to FS root (if permitted) you can use host//path


That does the trick! Thanks a lot!


Creating dirs ain't possible with this?


It should. If current user has permissions.


Current user gots al the permissions he need. I get the Reget error. Any example?
Or just like:
inetc::put /CAPTION "service pack upload" "ftp://user:pass@192.168.0.150:8021//Application/NewDir/5mb.bin" "c:\Dell\5mb.bin"


This work for me


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

Name "Inetc ftp mkdir Test"
OutFile "ftp_mkdir.exe"


;--------------------------------
;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

; use your own URL and login@pwd. Password hidden from user with /popup "ALIAS"

inetc::put /caption "service pack upload" /popup "" "ftp://takhir:somepwd@localhost/subdir/inetc.dll" "$EXEDIR\inetc.dll"
Pop $0
MessageBox MB_OK "Upload Status: $0"

SectionEnd

Sorry, CLI output is in Russian, but it is not difficult to understand
>dir /S /W
Том в устройстве C имеет метку OS
Содержимое папки C:\Users\takhir\Documents\wftpd\shared
[.] [..] [subdir]
0 файлов 0 байт
Содержимое папки C:\Users\takhir\Documents\wftpd\shared\subdir
[.] [..] inetc.dll
1 файлов 20_480 байт
Всего файлов:
1 файлов 20_480 байт
5 папок 130_276_462_592 байт свободно

It's not working for me. User got the permission to read/edit/create/execute.


inetc::put /caption "service pack upload" /popup "" "ftp://myuser:mypass@192.168.0.150:8021//Application/Test//inetc.dll" "C:\DELL\5mb.bin"
Pop $0
MessageBox MB_OK "Upload Status: $0"

Returns: Upload Status: Reget Error

*For testing I created a 5mb.bin*

With CLI and ftp open it's possible. Also tried several attempts using extra slashes.

Hello,

I have a problem with the unicode build of inetc. I am trying to send post values to a script on my website.

This is my command line:

inetc::post "t=i&v=2" /SILENT /TIMEOUT 2500 "https://www.mywebsite.com/myscript.php"  "$TEMP\BD-827364682984.txt" /END


Bot nothing is send, as if the connexion could not be established.

Thanks in advance for your help

I see one bug in code for UNICODE - POST message size should be defined in bytes, not in characters. But probably content-type header should be also changed to

Content-Type: text/html; charset=utf-16
Or this should be 16LE ?
BTW does ANSI version works with your request?

Idea to send Unicode string in http body is very attractive, but my experiments with Unicode POSTs were dissapointing. An it looks like browser sends form data as multibyte even if form was downloaded in page with utf encoding. So I just added body string convertion to multibyte, this worked in my tests. Please test attached dll.


Hello Takhir,

I have just tested the dll that you have attached and all work well. The problem is corrected (post values are sent correctly)

Thanks a lot for your work!

Regards


Zdravstvuj Takhir :-),

I'm wondering if you could help me with this.

I've got a php script which allows me to upload a file (just a normal HTML form with upload). I'd like to post data to that script and upload a file.

So, the question is - is it possible to use inetc::post to upload a file?
I guess I can use the TEXT2POST field, but I would have to MIME encode the file as a text and I'm worried that it will not be long enough.

If it's not possible, have you (or anyone else) got a better idea how to do it? Alternatively, would you be able to enhance inetc, so it's possible?

I can't use put as it's a IIS server and I can't enable webdav (to allow put).

Thanks,

Rob


I don't have ready solution for this :( Code sample may help, but I am not sure if I'll can find time for big changes in plug-in right now. I found one MS code sample, but it not sends file name to server while for normal (html form) uploads I can easy get file name in php...


I added the capability of using files as POST data, so as not to be limited by the NSIS variable size.

Usage: /FILE "filename" among inetc::post options. The 'content' parameter still needed, so it amounts to
inetc::post "blah" /FILE "filename" .....

Attached: source file with the modification, and a .dll with it compiled in. Non-Unicode, I somehow couldn't get those settings to compile, but didn't have time to figure it out at all.


I like simple solutions ;)
Few minor improvements and testing required, but idea looks good. Inet samples use HttpSendRequestEx() and InternetWriteFile(), but your approach may work as well - need to test this at least on 1MB files. And IMHO some corrections required: POST body size should be file size, not strlen() in this case (jpeg file may have a lot of zeroes); additional error handling for file IO required (part of file may be locked... in theory :) ); first parameter may be used as file name, /FILE option this case will be without parameter. And may be good to think about MIME-encoding of file to be sent, and about content headers like Content-Disposition: form-data; name="ImageData"; filename="somefile.jpg" Content-Type: image/jpeg - this sends file name I wrote above (sample from http://pics.livejournal.com/doc/prot...ata.simple.bml ).
But any case this looks good, thanks for your help, SinusPi!


Hi there,

Not sure if it helps, but here is how can this be implemented. The example is using python and wget, but shows the necessary steps that are involved in posting a file:
http://www.noah.org/wiki/WGET_CGI_Post
(www.noah.org/wiki/WGET_CGI_Post)

And this is what the post request looks like when uploading a file in FireFox:

Content-Type: multipart/form-data; boundary=---------------------------188752843329869
Content-Length: 76298

-----------------------------188752843329869
Content-Disposition: form-data; name="file"; filename="HttpAnalysisPluginSP14.zip"
Content-Type: application/x-zip-compressed

<The base64 encoded data go here>

-----------------------------188752843329869
Content-Disposition: form-data; name="submit" Submit
-----------------------------188752843329869--


Hello..
I need also to use the POST request with /FILE support (to skip NSIS string limitations)
Where can we get this updated version of inetc?
Is it available yet?

BTW, thanks for the plugin :)

Olivier


Download fails
Hi, great plugin. I use it in my installer to download & install the .NET framework when it is not yet installed. It works perfect 99% of the time.

However, once in a while a customer calls that it does not work. When they retry it does work. I'm not entirely sure but the problems seems to occus when my installer is executed immediately from Firefox. I've tried to reproduce it on a virtual machine, and it occurs exactly one time. After that it keeps working fine.

Is this a known issue? If not, I'm happy to help to debug this issue. Is there a way to get logs or anything?

Thanks,
Robbert Dam


/FILE option now available in inetc. This is not classic file post implementation, but this work and file content is available as http input. File name (tail of TEXT2POST parameter) added to HTTP headers as Filename: header. Samples included into new package. Please test before using ;).
Also please note new sample on wiki page http://nsis.sourceforge.net/Inetc_plug-in from Edward Marshall & Jonathan Beddoes - how to restore installer window after silent calls from .onGUIInit


Thanks for the addition, Takhir! We will check that out and get back to you if any problem..


Progress bar size
How can I make the download progress bar have the same size with the global installer progress bar ? (I'm using MUI)
Now it's kind of goofy looking:

http://img259.imageshack.us/img259/3368/45369592.png


You'll need to modify the plug-in.

Stu


Thanks, I took your suggestion. If anyone needs this, just modify inetc.rc and rebuild:

IDD_DIALOG3 DIALOG DISCARDABLE  0, 0, 300, 62
STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",0x0,0,23,
300,11
CTEXT "",IDC_STATIC1,0,8,266,11
PUSHBUTTON "Cancel",IDCANCEL,213,41,80,16
END


When recompiling with a newer Visual Studio, make sure you link against libcmt.lib and not msvcrt.lib as by default, otherwise you will require msvcrXY.dll at runtime depending on your VS version. The statically linked plugin is a tad larger, but works everywhere.

Probably better if the plugin conformed to the UI at hand.. I'm guessing your adjustments would break its working with a Classic interface (or UMUI, XPUI, etc.) / other font sizes (inherent dialog unit<>pixel changes.. original plugin suffers from this as well).

I used the WndSubClass plugin to handle some of that.. lot more trouble than it's worth, though ;)


@punkomat: also make sure you tell VS not to embed a manifest otherwise (I believe) the CRT dependency remains.
@Animaether: that mod should work fine because it's in dialog units not pixels.

Stu


Doesn't it presume the parent dialog being 300 units wide, though?


Ah sorry yes that is true.

Stu


Url parts error
I have a weird error using this plugin: I get a Url Parts error when downloading a certain file. The other files are fine, I tried deleting and reuploading the file, I tried a different file with same filename, so it's a url issue. It only occurs on XP (which I test in a VM). On my native Win7 OS, it works fine.

  !insertmacro DownloadFile "http://sevenupdate.com/apps/SevenUpdate/SevenUpdate.Helper.exe" "$INSTDIR\SevenUpdate.Helper.exe"


Here is my complete script: http://code.google.com/p/sevenupdate...evenUpdate.nsi

may be too many quotas? what about inetc::get ${SOURCE} ${DEST} /END ?
Also options should stay before url/file pairs inetc::get /TIMEOUT=30000 /NOPROXY "${SOURCE}" "${DEST}" /END


Url Parts error

Originally posted by sevenalive
I have a weird error using this plugin: I get a Url Parts error when downloading a certain file. The other files are fine, I tried deleting and reuploading the file, I tried a different file with same filename, so it's a url issue. It only occurs on XP (which I test in a VM). On my native Win7 OS, it works fine.
I am having a similar issue. Did you found out the origin of the problem??

No not yet, I am sure it's related to the plugin and XP because Win7 it works fine. Also I already tried moving the params before the urls, gives me File Open Error instead.


Verify that your "$INSTDIR exists when you start download to this folder.


/BANNER with SilentInstall
Hello,

I use NSIS to run a Java program, so I run it in SilentInstall.
However, before it runs, I check if java.exe is present, if not I download the JRE using Inetc::get.

My issue is that in "SilentInstall silent" mode, the /BANNER or /POPUP do not show the downloading progress windows.
I know this was done on purpose since it is supposed to be "silent", however is there an option or a way to implement that the progress windows shows up, like a /NOSILENT option?

That would be great!
Thanks


Originally posted by bsmith1
Hello,

I use NSIS to run a Java program, so I run it in SilentInstall.
However, before it runs, I check if java.exe is present, if not I download the JRE using Inetc::get.

My issue is that in "SilentInstall silent" mode, the /BANNER or /POPUP do not show the downloading progress windows.
I know this was done on purpose since it is supposed to be "silent", however is there an option or a way to implement that the progress windows shows up, like a /NOSILENT option?

That would be great!
Thanks
You could embed in your silent NSIS launcher another not-silent NSIS installer that would take care of the download part.

Originally posted by Wizou
You could embed in your silent NSIS launcher another not-silent NSIS installer that would take care of the download part.
Thank you Wizou for this workaround. I will give it a try.

Cheers

Archive: http + ftp download plug-in


Originally posted by bsmith1
I know this was done on purpose since it is supposed to be "silent", however is there an option or a way to implement that the progress windows shows up, like a /NOSILENT option?
Yes, this is possible to implement, I even tested 'small' changes and found that for installer with /S dialog appears in the center of screen. Looks a bit ugly for silent install, IMHO would be better to move it to the right bottom corner. Or to left top. May be /NOSILENT /POSITION X:Y (percents, pixels?). So we need to understant a full set of options for this feature. Code update for this may take time (and I need to find this time in my schedule :( ).

/RESUME seems buggy for me.

If I enable it without the extra text parameter then the download errors with "connecting". If I add the extra text, then I properly get a pop up, however clicking retry seems to do nothing and the pop up just comes up over and again and the download never resumes, when clicking cancel I get "reget error". Any idea on what could be going on ?

-Using win7 64bit
-compiled non unicode script
-file is in direct download and support resuming (through firefox or download manager)
-no other options used for inetc
-tried disabling device or unplugging cable gives same result

Help appreciated!


/RESUME RETRY_QUESTION - parameter is mandatory. On error during download plug-in asks you what to do - continue download or fail with rising some error (reget error in this case). If network cable still disconnected, Resume popup will appears again. Normal behavior is to restore connection (where is my VPN! :) ) and press Resume button after this only.


Thanks for the reply Takhir!

For the parameter: yes I was confused by the existence of a default value. Seeking for example I figured it was used if you use an empty string "" as parameter, problem solved.

However for the pop up, this is exactly my issue, the plugin seems to fail to detect my connection is available again. i.e. after plugging the cable back in and even if internet works perfectly, the pop up with retry/cancel error will keep showing up, refusing to restore the download.


Looks like I owe you an apology. Your files work perfectly. As the history page show (http://nsis.sourceforge.net/File:Inetc.zip) someone else applied modifications on your plugin which caused the bug, using the last version uploaded by yourself (16:04, 13 July 2010) works perfectly. I don't know why/who modified it but you might want to revert it.

Thanks for your awesome work :)


Sorry, after reading code :) : Reget error for http means that InternetSetFilePointer() failed with (REST for ftp). So connection itself was already established, but server could not continue download from this position. Dynamic content names, unknown file size in reply, server functionality limitations - what else? Could you reproduce this on another server? On static content/file?


Thanks, Necku, presisely, JohnTHaller added 2 flags "for cleanliness", but "This handle must not have been created with the INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_NO_CACHE_WRITE value set." Main idea from the very beginning was to add reget support. But I'll think a little is this a bug or feature :). May be well need to rollback inetc version.


You're welcome, I'm happy as long as it works :D

On a side note I'll pm you the URL I used for tests so you can see by yourself :)


Unfortunatelly I cannot login to sourceforge now (server internal error), so I am attaching patched version here for the moment. New flags will be used if resume option not set only. Necku, if you will have time, please test this ;)


Originally posted by Takhir
Unfortunatelly I cannot login to sourceforge now (server internal error), so I am attaching patched version here for the moment. New flags will be used if resume option not set only. Necku, if you will have time, please test this ;)
Works like a charm :)

First I'd like to say thanks for the plugin, it looks to be exactly what I've been looking for.

I am having a small issue with inetc::get it works for the most part, but on my server logs it's showing as POST instead of GET.

The version I'm using is the one you posted above on the 14th.

Example:

Section "Dummy Section" SecDummy
inetc::get /USERAGENT "Some Browser" \
"http://somesite.com/somepage.html" "$EXEDIR\somepage.html"
Pop $0
MessageBox MB_OK "Download Status: $0"
SectionEnd


I re-tested 2 last versions and in apache logs I see:
127.0.0.1 - - [25/Feb/2011:19:45:35 +0300] "GET /aut_1986.htm HTTP/1.1" 200 17952
127.0.0.1 - - [25/Feb/2011:19:55:11 +0300] "GET /aut_1986.htm HTTP/1.1" 200 17952
for the following script:
inetc::get /useragent "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)" "http://localhost/aut_1986.htm" "$EXEDIR\aut.html" /end
In code I see 3 situations where POST may have place: 1) inetc::post(); 2) /file ; 3) /NOUNLOAD in previous POST request. Any other ideas?

Latest release is here http://nsis.sourceforge.net/File:Inetc.zip


Thanks Takhir,
I've tried your example with the latest version and it works fine. My problem appears to be with the agent string I've been trying to use.

Works fine:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)

Causes POST:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET CLR 1.1.4322; InfoPath.2)


You are right, cole2k, string size limit 128 chars in current version for user agent. Most of strings in inetc allocated dynamically with size 1k or 8k depending on NSIS build, but not user agent. Most of servers support at least 8kB fields. I'll fix this in next release.


/resume
Dear sirs,
I’m trying to use your plugin with parameter/RESUME
Everything seems to work normally.
We started downloading, then disconnected the network cable, downloading broke and a message requesting to resume/cancel the downloading appeared. We connected the cable, clicked “resume” and downloading continued.
But actually, there is no real downloading. The plugin downloads everything from the start till the moment of break and then continues downloading.
For example, I’m downloading a 600 mb file.
When 200 mb are downloaded, I disconnect the network and then connect it.
The downloading process seems to continue but the progress bar doesn’t move ahead.
Once the plugin downloads those 200 mb once again he continues the further download.
Is this the way the plugin operates or is it an error?
What can we do to resume the downloading from the point of downloading break?
Thank you.


Hello,

first of all thanks a lot for that great plugin!

I saw that there is a new release with this resume flag and I tried it by myself. I've the same issue as yyv.

In addition to that there are sometimes errors while downloading files that are bigger in size while there is kaspersky running on that client. The antivirus scanner trys to check the complete file after download and then the inetc.dll is running into a timeout which is not regarding due to an issue of the connection. This problem appears on several systems - windows xp / vista / 7.

Any ideas?

Thanks a lot again and hopefully we will se a lot of updates to this plugin in feature!


I prepared small patch for reget feature, but we still have this problem on nginx server (apache is OK), so please wait few days.
No ideas about virus protection....


@Takhir - what I also found out so far about the "kaspersky issue" is that downloads of the same files in browsers also take for about ~30 seconds till they are finished. During this time the progress bar and the percentage info stucks on 99%,too.

The delay until the Internet Explorer throws an error is much later then of inetc.dll. Maybe it is regarding how the WinInet lib is used of both (please correct me if I'm wrong).

What I have tried so far is to reset the browser settings. Reference to microsoft answer: Download stucks at 99% Solution - still the same issue.

Is there a delay not regarding an connection timeout that can be configured till the download will be aborted?

Thanks a lot again for your fast answer!


I looked into your source code and there are a lot of other TIMEOUT settings that can be applied to "hinternet" - and in the past, some of them, weren't implemented.

InternetSetOption(hSession, INTERNET_OPTION_SEND_TIMEOUT, &timeout, sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_DATA_SEND_TIMEOUT, &timeout,
sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_RECEIVE_TIMEOUT, &timeout,
sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, &timeout,
sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT,
&timeout, sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_CONTROL_SEND_TIMEOUT, &timeout,
sizeof(DWORD));

The reason why I did this is, because I tried to increase the timeout and shut down my http server during the download. After that the error message appeared in exaclty the same time.

Maybe it is a bug?!


May be. But MSDN says that DATA_SEND/RECEIVE_TIMEOUT related to ftp only. CONTROL_RECEIVE is identical to RECEIVE. So the only flag that can help with big files download via HTTP is INTERNET_OPTION_RECEIVE_TIMEOUT (probably no separation of HTTP header and data).
Currently plug-in can use not default INTERNET_OPTION_CONNECT_TIMEOUT only (if set in parameters - /timeout). I do not remember why it was added in 2005 :), but IMHO this option is good. This way we can change IE default setting for connection t/o. If you can test RECEIVE_TIMEOUT flag and confirm that this resolves situation with antivirus (this may be true if Kaspersky catches data before Inetc), I'll add this new option.
Thanks, Takhir


I tried various settings now in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

ReceiveTimeout (REG_DWORD) = 300000
KeepAliveTimeout (REG_DWORD) = 300000
ServerInfoTimeout (REG_DWORD) = 300000

But I had no success, because I received the error message every ~3000 Milliseconds and not as expected ~5 minutes.

So I had a deeper look into the source code.

Please correct me if I'm wrong, but you are using a thread which is waiting if there is a transfer and if not it will abort after 3000 milliseconds, right?

Line: WaitForSingleObject(hThread, 3000) == WAIT_TIMEOUT

Could it be that the timeout which is going to be set via RECEIVE_TIMEOUT and CONNECT_TIMEOUT should influence this timeout, because the thread would exit to early?

In my opinion the changes of the RECEIVE_TIMEOUT would be only a little (~5 lines -> cmd line parsing and call in the function itself), so I would add it to the next version, to set it as needed.

P.S.: A few options are not mentioned in the wiki (for example: nocookies).


could it be the plugin ignores the default font rendering settings when used in /BANNER mode? it seems to ignore the fact i have cleartype enabled.


Hello again,

@Takhir : Anything new to Yathosho and my objections?


Originally posted by klopfdreh
Please correct me if I'm wrong, but you are using a thread which is waiting if there is a transfer and if not it will abort after 3000 milliseconds, right?

Line: WaitForSingleObject(hThread, 3000) == WAIT_TIMEOUT
No, in this line plug-in waits transfer thread termination after Cancel button was pressed. On server termination DATA_RECEIVE_TIMEOUT probably defines time. If you tested InternetSetOption(hSession, INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, &timeout,
sizeof(DWORD)); and this work as expected please let me know (or I'll test this when I'll have time - a lot of job now :( ). Both options - connection and receive timeouts have sence, so let's test and add new feature :).

> P.S.: A few options are not mentioned in the wiki (for example: nocookies).
Thanks!

> could it be the plugin ignores the default font rendering settings when used in /BANNER mode? it seems to ignore the fact i have cleartype enabled.

Yathosho, please send me minimum size sample script and I'll test this. Only english/russian/italian systems are available now for me :).

@Takhir: Thank a lot for the fast answer again. Well I don't have the environment to compile the source :( . Would you please so kind and test it?

The way I did was simply to limit the transfer rate of the http server and shut it down, before the download was finished. The response always appears after ~3 Seconds, thats why I was supposing it could be the line I worte. And in the case of the virus scanner it also appears in ~3 Seconds, because the file is beeing scanned.

It would be really really nice, because we are using your lib to update clients automatically in an environment with ~1500 users. :)

I think it should be only a little change, just those lines that get the parameter out of the call and if the parameter contains the receive timeout the call of the internetSetOption.


Now I tried to compile it with cygwin by myself and I got some errors during the compilation (picture)

@Takhir: Because I can't compile it easily - would you be so kind and add/change the following lines to inetc.cpp and recompile it? I think it should work that way:

line 208:

timeout,
receivetimeout = 0;


line 799:
if(receivetimeout > 0)
InternetSetOption(hSes, INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, &receivetimeout, sizeof(receivetimeout));


line 1374:
else if(lstrcmpi(url, _T("/receivetimeout")) == 0)
{
popstring(url);
receivetimeout = _tcstol(url, NULL, 10);
}


That would be very very nice of you. If you could do this and post a new build in here I would check if that will solve our problem!

Edit: I was able to solve the error with the exdll by using the exdll.h and the api.h of the current source of nsis but the error in inetc.cpp on line 648 still appears.

You don't need to use strtol (you don't want a dependency on CRT). NSIS exposes popint() and myatoi() that you can use.

Stu


Ok, I solved it for my environment. I used dev-c (g++) within cygwin:

g++ -c inetc.cpp -I/usr/include/mingw -lwininet -lcomctl32
g++ -shared -o inetc.dll inetc.o -I/usr/include/mingw -lwininet -lcomctl32

and I used the exdll.h and api.h attached to the post.

@ Afrow UK: It is not my code. I only want to recompile and test the changes posted above.

Edit: Well my dll doesn't work! :D I hope I will get it running today.

Edit2: Mmhhh I don't know why it is not working for me, the result if I compile the dll is, that the return value is not "OK". Example:

inetc::get /NOCOOKIES /TIMEOUT 300000 /NOCANCEL /CAPTION "$(^Name)" /RESUME "..."

Pop $R0

MessageBox MB_OK $R0

$R0 is always the first paramter I give into the dll call....


I am sorry... and thank for your efforts!
I am attaching build with your changes, please send me info if you need something else and I'll try to do this tonight.


@Takhir: Thank you very very much! Maybe you are able to tell me what I did wrong with the compilation?

I don't know why it doesn't worked for me - even NSIS was compiling fine...

Edit: I tried the new version with the internetreceive timeout and if I have the kaspersky virus scanner installed, it trys to check the download after the tranfer and then aborts. :cry: I've tested it on a vmware box already...

Edit2: BUUUUUTTTT!!! I tested the ReceiveTimeout in the registry again and then the download worked for me. Seems that the internetSetOption with INTERNET_OPTION_DATA_RECEIVE_TIMEOUT doesn't apply it to the current connection.

Brrrr.... this smells like an ugly sh* but I'm going to set the dword previously:

WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" 'ReceiveTimeout' 0x001b7740


Thanks, klopfdreh

Attached plug-in worked as expected (for me ).
Finally: INTERNET_OPTION_RECEIVE_TIMEOUT sets what we need. Interesting information from MSDN 2005: INTERNET_OPTION_DATA_RECEIVE_TIMEOUT 8 Not implemented.
Now Inetc options are /connecttimeout and /receivetimeout, both in seconds (not milliseconds!). I.e. 60 sec timeout will be /receivetimeout 60

And ... this not took many time after I understood how to test timeout - simple php script with sleep() . Included to zip. please let me know if big files problem resolved.


Great! Thanks a lot! I'm going to test it without the reg key and with this new version, now!

Edit: It is working like a charm, even without the registry entry - thank you very very much! :D

I think we should add those changes to the wiki, too. It is a great change and really usefull!


Thank you very much, klopfdreh! I'll add this patch shortly to archive.


Originally posted by Takhir
Yathosho, please send me minimum size sample script and I'll test this. Only english/russian/italian systems are available now for me :).
(screenshot based on your cameron diaz example)

is the banner using the system font? it should be antialiased according to my windows settings, but it's not.

btw, i have tried to use InetLoad with three switches (/TIMEOUT 5000 /RESUME /BANNER) but the download only works when using just one of these. the documentation and examples don't deal with multiple switches, is it even possible to chain these?


Hi all - I've noticed that when using embedded progress bar the text above the main progress bar is always printf("Downloading %s",filename), ignoring the caption switch. so I've changed the code a bit to make the text printf("%s",caption) if the caption switch exists.

If you think the this is really a bug you can merge it. Anyway, this is what the I thought the expected behavior would be.

Thanks,

J


Feature Add Request -
- If download file already exists, check hash, if OK do not re-download
- Resume download even if user Cancels it, something like /NODELETE option on nsisdl v1.4
- on resume prompt, window title is 'Inetc plugin', it should be either removed completely or changeable via some option

Currently both above are available nsisdl v1.4 but it does not have authentication/proxy handling features that inetc can do.

PS - let me know if above features are already available and i am missing something.
Great thanks to all!


Originally posted by ManoKum80
- If download file already exists, check hash, if OK do not re-download
This is actually trivial to implement in NSIS code. Use the md5dll plugin.

Bug?
I think I found a bug in Inetc but I'm not sure - for some reason it clears the stack after cancelling. Does anyone see this behavior also?

EDIT: It clears the stack when clicking cancel and then it pops up an are you sure dialog - while it continues to download - if it finishes to download while the dialog is still open and then I press "Yes" (which means - yes, I'm sure I want to cancel) It clears the stack. If everyone see this behavior - I think it's pretty critical...


Originally posted by zenpoy
I think I found a bug in Inetc but I'm not sure - for some reason it clears the stack after cancelling. Does anyone see this behavior also?
inetc can download few files, so stack can include few pairs of URL/file, on termination plug-in should remove tail from stack. Best of all is to use /end paramater in your command line.

Archive: http + ftp download plug-in


the command line I'm using is:

Inetc::get /NOPROXY /QUESTION "" /CAPTION "Installing $TITLE" $IS_PROXY_ALLOWED $URL $R3 /END


Anyway - I think I fixed it I've changed dlgProc, case IDCANCEL to be:

case IDCANCEL:
if(nocancel) break;
if(szQuestion) {
msgboxAnswer = MessageBox(hDlg, szQuestion, szCaption, MB_ICONWARNING|MB_YESNO);
if (msgboxAnswer == IDNO)
break;
else if (status == ST_DOWNLOAD)
status = ST_CANCELLED;
}


ok... now I've fixed it
Sorry for spamming the thread... The former solution wasn't a solution - it did not clear the stack but it returned a wrong status. So please ignore the last fix.

There's a function called inetTransfer which pops pairs of url and file name and downloads them. what I did was to add two lines right after the loop that does that:

if (lstrcmpi(url, _T("/end"))==0)
pushstring(url);

And in cleanup section I removed the status check - so now I always clean the stack.

Hope it makes sense to anyone. If you want the fixed version, tell me.

J.


Originally posted by zenpoy
Hope it makes sense to anyone. If you want the fixed version, tell me.
J.
Thanks, zenpoy!
If you can send me PM with updated source, I'll merge changes and build new release for wiki.
Unfortunatelly I am overloaded with business tasks and had not time to dig into proble, sorry :(.
Takhir

What do you use to compile inetc?
When I'm using the inetc.dll out of the box (that is, out of the zip) it works fine in winxp sp2. When I use my x64 (win7) pc with both vs2008 and vs2010 to compile the source code it produces a dll that works in win7 but is not working in winxp sp2 (without any updates/vc++ packs or anything, completely fresh install).

When I try to call inetc:

 
strcpy $R0 "http://www.google.com/intl/en_com/images/srpr/logo2w.png"
Inetc::get /SILENT /CONNECTTIMEOUT 10000 $R0 "image.png" /END
dumpstate::debug


it leaves the args on the stack ( /SILENT /CONNECTTIMEOUT 10000 $R0 "image.png" /END)

So how do you compile it to be compatible for xp sp2??

Thanks

I compile it in VS 6 on XP or Vista. Resulting DLL depends on msvctr.dll but this is OK. You can change settings in later VS to multithreaded DLL, this case module size should increase, but without dependencies to runtimes. IMHO targetver.h should not produce any conflicts.


Thanks! that helped... I tried to change to multithreasded DLL but still, it didn't work. So I used VS6 and it works like a charm.


Oups... Sorry, 'multithreaded' only. No 'DLL' and no dependencies to runtimes this case. But any case VS 6 is better way.


I have now another issue with winxp32 sp2. In win7/vista and others I can redirect from https to http. but in winxp32sp2 I get error Redirection (302). I thought I should add something like:



InternetQueryOption (hFile, INTERNET_OPTION_SECURITY_FLAGS,
(LPVOID)&rslt, &(err = sizeof(rslt)));
rslt |= SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP;
InternetSetOption (hFile, INTERNET_OPTION_SECURITY_FLAGS,
&rslt, sizeof(rslt) );



but it didn't work - I'm not that familiar with the code, can you give me some guidance?

Inetc already has

#define MY_REDIR_FLAGS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS

for primary https URL. 'SECURITY_' flags are the same

#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP

So I guess problem is in this XP settings or in WinInet.dll version supplied with this OS/SP.

I am attaching test version with merged code for 'Cancel' issue (because it's not possible to send link in PM :( ). BTW I am not sure if anybody use this 'multiple download' mode. May be has sence to remove this option and download one file per Inetc call? For me this even simpler then long-long-long strings with name-URL pairs...


1. regarding the winint.dll and https->http redirection in xp sp2, I found out this http://support.microsoft.com/kb/907301 issue, and applying the hotfix (which only replaces winint.dll and adds registry key) solves it! the bad news is that wininit.dll is a 'KnownDll' which means it always loaded from Windows\System32 and only OS can update it. I think the only way is to change the redirection to be like XP SP2 wants.

2. regarding the 'cancel' bug - looks good :) The bug is not related to multiple downloads, I use only one download at a time, and I had this bug.


Hello Takhir,

First of thanks for the plugin. I however encountered a problem with the FTP PUT functionality of the plugin. It has to do when PUTing files that are in non-existing (on the FTP server) subdirectories.

The plugin determines if a FTP PUT upload failed due to a non existing subdirectory and tries to create the necessary subdirectories.

However the code that determines non-existing subdirectories relies on the FTP server's response. And I encountered a FTP server where the code in the plugin failed.

I attached two images with the different responses by different FTP servers on non-existing directory.

Code fix should be easy, around line 528 in inetc.cpp:


if(fput && _tcsstr(buf, _T("550")) != NULL)
{

Change to: (or what you prefer)

if(fput && (_tcsstr(buf, _T("550")) != NULL || _tcsstr(buf, _T("553")) != NULL))
{


I saw a few messages that also had problem with subdirectories and FTP PUT earlier in the thread. Those probably had to do with this as well.

Good job, tperquin, than you!
I uploaded new release http://nsis.sourceforge.net/File:Inetc.zip


in .zip lost non-unicode version


Oups... Fixed.


It seems that inetc, even in a completely silent installer with no splash screen or other plugins, will still steal focus from another app when it is instantiated. Does anyone know of a fix for this?


It looks like inetc::head is corrupting the stack.

    DetailPrint "Beer is placed on the stack.."
Push "BEER"

inetc::head "http://download.macromedia.com/pub/flashplayer/current/install_flash_player_ax_32bit.exe" "$TEMP\Temp.dat"
Pop $0
DetailPrint "Result of inetc::head = $0"

DetailPrint "Reach for Beer..."
Pop $0
${If} $0 == "BEER"
DetailPrint "Sip... ahh... sweet sweet beer!"
${Else}
DetailPrint "I'm sorry but inetc::head drank your beer. :'-("
${EndIf}


Please won't someone find my beer?

Zinthose, try putting /END as the last argument to tell inetc where is the end of your argument list:

inetc::head "http://download.macromedia.com/pub/flashplayer/current/install_flash_player_ax_32bit.exe" "$TEMP\Temp.dat" /END


You found my beer!

Weird bug though... need a tinfoil hat for this one. :tinfoil:


Details button and information text in instfiles page
Hello!

Since I wrote the last time into this thread the plugin is working like a charm, so thanks a lot first!

I have only two little feature request regarding the detail button and the information which are being displayed.

1. Is it possible not to grey the button out, but instead to make it pushable and print the downloading information into the textarea on each refresh?

Example:
<filename>: 14071kb (6%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 32833kb (14%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 53940kb (23%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
.
.
.

2. Is there a way to show which file is downloading at the moment, because in my installer there is only the product name displayed on top of the installation bar?

Example:

Downloading: <filename>
[ || || || || || || || || || || || || || || || || || || || || ]

Thanks a lot!


Odd Error with Inetc::get
Using the below simple test code at both my work (win7) and home (xp) hosts I get
the error "U" off the stack. I'm using NSIS 2.46 and the latest Inetc plugin from
http://nsis.sourceforge.net/Inetc_plug-in.



Name "InetClient GET Test"
OutFile "get.exe"

!AddPluginDir ./plugins

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

Section "Dummy Section" SecDummy

SetDetailsView hide
; single file, NSISdl-style embedded progress bar with specific cancel button text

inetc::get /canceltext "interrupt!" "http://drav.net/test.md5" "$EXEDIR\test.md5" /end
; NSISdl::download /TIMEOUT=30000 http://drav.net/test.md5 $TEMP\test.md5
Pop $1
MessageBox MB_OK "Download Status: $1"

SectionEnd

;--------------------------------
;Installer Functions

Function .onInit
FunctionEnd


The Error appears as so (and no file is downloaded).

http://drav.net/error.jpg

test.md5 38 bytes, status OK. String may be trancated to first char only ('U') if you use Unicode plug-in version with multibyte installer.


Re: Odd Error with Inetc::get
Yep that was it, drop in the "plugin/Inetc.dll" file (rather than unicode/Inetc.dll) and volia - It works :D

Cheers for the quick response (as ever!) Takhir!

Regards

D.


Originally posted by klopfdreh
Hello!

Since I wrote the last time into this thread the plugin is working like a charm, so thanks a lot first!

I have only two little feature request regarding the detail button and the information which are being displayed.

1. Is it possible not to grey the button out, but instead to make it pushable and print the downloading information into the textarea on each refresh?

Example:
<filename>: 14071kb (6%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 32833kb (14%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 53940kb (23%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
.
.
.

2. Is there a way to show which file is downloading at the moment, because in my installer there is only the product name displayed on top of the installation bar?

Example:

Downloading: <filename>
[ || || || || || || || || || || || || || || || || || || || || ]

Thanks a lot!
Hello again,

only wanted to say that I solved the "2." by settings the right caption, but point "1." would be really nice if it is possible. :D

Originally posted by CritterNYC
It seems that inetc, even in a completely silent installer with no splash screen or other plugins, will still steal focus from another app when it is instantiated. Does anyone know of a fix for this?
I noticed same issue, at least when using inetc from another process. From what I discovered, to avoid this, WS_EX_NOACTIVATE style should be set in dialog template.

Hello everyone again,

I got some troubles with the inetc plugin and a low speed http server. After an undefined time the download aborts and a dialog show an error that the connection isn't available. If I press retry the dialog is shown again - so there is a loop which always show the error message and retry/abort. If I press abort the process is aborted as expected. The error is not within the time of 1800 seconds - it appears randomly.

I'm using the following call in our NSIS script:


inetc::get /NOCOOKIES /CONNECTTIMEOUT 1800 /RECEIVETIMEOUT 1800
/NOCANCEL /CAPTION "$(INETCHeader)${What}" /TRANSLATE
"$(INETC1)" "$(INETC2)" "$(INETC3)" "$(INETC4)" "$(INETC5)"
"$(INETC6)" "$(INETC7)" "$(INETC8)" /RESUME
"$(DownloadResumeWarning)" "$downloadURL${What}"
"$userhomeworkingdir\${What}" /END


Thanks a lot!

Originally posted by CritterNYC
It seems that inetc, even in a completely silent installer with no splash screen or other plugins, will still steal focus from another app when it is instantiated. Does anyone know of a fix for this?
Yes, this has to do with WM_INITDIALOG not returning false.

From MSDN:
The dialog box procedure should return TRUE to direct the system to set the keyboard focus to the control specified by wParam. Otherwise, it should return FALSE to prevent the system from setting the default keyboard focus.
Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.

[OT] Thanks for the fix, but seriously you are using Visual C++ 6.0 and Win 95 ??? [/OT]


Originally posted by T.Slappy
[OT] Thanks for the fix, but seriously you are using Visual C++ 6.0 and Win 95 ??? [/OT]
Yea. NSIS supports Windows 95 or higher. If I compile the source with anything higher than Visual C++ 6.0, the resulting DLL will not work on Windows 95. I have a Virtual PC Windows 95 image which makes it easy and I just had to downloaded Visual C++ 6.0. I compiled on Windows 7 and copied it over to the VM and tested the installer with the DLL.

Originally posted by negativesir
Yea. NSIS supports Windows 95 or higher. If I compile the source with anything higher than Visual C++ 6.0, the resulting DLL will not work on Windows 95. I have a Virtual PC Windows 95 image which makes it easy and I just had to downloaded Visual C++ 6.0. I compiled on Windows 7 and copied it over to the VM and tested the installer with the DLL.
[OT]
Thanks for explanation, nice job.

I assume nobody uses version below Windows 2000 and also Microsoft does not support such old versions any more.
[/OT]

Originally posted by T.Slappy
[OT]
Thanks for explanation, nice job.

I assume nobody uses version below Windows 2000 and also Microsoft does not support such old versions any more.
[/OT]
I don't doubt that. I know Microsoft doesn't support Windows 9X but NSIS does! Let me put it this way, I have a duty.. no a.. moral obligation.. to ensure that my patch does not break the minimum OS requirements.

Originally posted by negativesir
Let me put it this way, I have a duty.. no a.. moral obligation.. to ensure that my patch does not break the minimum OS requirements.
Like!!!

For me it's not showing any window with download information which is very annoying..


Where are you calling the plug-in from? To show download progress you probably need to use it in a Section (and without /silent).

Stu


Can I resolve the filename from the request with inetc?
I have a url which I download a file from during install, this url is using redirection and the name of the file is based on some of the get parameters I use. Anyway, is there a way to use inetc to use/extract the filename from the last redirection in the redirection chains and use that as the filename? I have no problem do the change myself and try it, but I don't have to much experience with wininet api.

BTW - When I put the url in the browser (e.g. chrome) address bar it automatically uses the correct filename to save the file - this is the behaviour I would like to implement.

Thanks


Originally posted by negativesir
Yes, this has to do with WM_INITDIALOG not returning false.

Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.
Thank. You save my day.

Takhir, are you planning to include this fix into new version?

Hey guys,

Just a disclaimer, I'm still new to NSIS in general

The INETC plugin seems to work very well in general, although I'm having an issue which appears to be intermittent.. Basically i am attempting to retrieve a large number of files, approx 2 GB in size spread over 150 files and the transfer of some files are failing intermittently.

I am using the /resume switch and when the failure occurs it takes place somewhere in the middle of a file transfer, when I click on resume, I right away get the same popup coming up asking if i want to resume or cancel.

If i close up the installation package entirely, it will usually go through that file no issue but then fail on another. I'm not seeing any patterns as to specific files failing over and over again, it looks like its completely random.

I thought it might be network related so i ran wireshark to verify if the outbound httpd request goes through and it does.. Also, if i cancel that specific file the next few files go through without issue and since they are all retrieving from the same web server i don't believe its network related.

I'm not sure where to look to get this resolved, can i enable any additional logging?

I can post the script if necessary

Thanks in advance


Is there any safe way how to detect the source of the problem when downloading file fails (inetc::get) ?

Sometimes I am getting ERR_SENDREQUEST which is "SendRequest Error" but I cannot found the problem.

Here is code:

boolqueryStatus(HINTERNEThFile)

{
TCHARbuf***91;256***93;=_T("");
DWORDrslt;
if(
HttpQueryInfo(hFile,HTTP_QUERY_STATUS_CODE,
buf,&(rslt=sizeof(buf)),NULL))
{
buf***91;3***93;=0;
if(
lstrcmp(buf,_T("0"))==0||*buf==0)<<<Theresultcodeiszero(0)-butwhy???
status=ERR_SENDREQUEST;

Hi,

I'm trying to use inetc to download files. I allow users to cancel the download, and to try to download the file a second time. I use the following code:

Function OnDownloadPageClose
Push $0
;Download the file
inetc::get /BANNER "Download in progress." \
/CAPTION "Downloading..." \
"http://www.myuri.com/myfile.txt" \
"$DownloadDirectory\myfile.txt" \
/END
Pop $0
${If} $0 == "OK"
ExecWait "$DownloadDirectory\myfile.txt -d$\"$DownloadDirectory$\" -s"
Delete "$DownloadDirectory\myfile.txt"
${Else} ;an error occured
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"The file could not be downloaded. This may be due to a faulty \
Internet connection. Click 'Yes' to try again, or click 'No' to finish installation \
without downloading the optional files." \
IDNO exit
Delete "$DownloadDirectory\myfile.txt" ; !! THIS DOES NOT WORK
Pop $0
Abort ; do not go to the next installer page, so the user can try again.
${EndIf}
exit:
Pop $0
FunctionEnd


This does not work, most likely because when the download is interrupted by the user (closing the download pop-up) the half-downloaded-file cannot be deleted. It is also impossible to delete the file manually for as long as the installer is running ("Another program is using this file").

Edit: I get the same issue in other modes (besides banner mode) when clicking the cancel button. It seems like cancelled downloads are not properly handled -- the downloaded files are never closed. Then again it might just be that I have forgotten some essential operation.

inetc automatically deletes the file on dl cancel; why it doesn't in your case, it's hard to say. Does the problem persist with some other file from a different server? Try using Unlocker to see if some 3rd party sw is hijacking the file. If you can't resolve the problem, a workaround can be to use GetTempFileName for the destination, then move the completed dl to target dir.


Archive: http + ftp download plug-in


Originally posted by negativesir
Yes, this has to do with WM_INITDIALOG not returning false.

From MSDN:


Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.
Thanks, negativesir. I've verified that this fixes the issue with stealing focus and otherwise works unaltered. I wasn't sure if you'd compiled as release or debug back when you'd submitted this, so I recompiled it using a clean VC++6 under a clean Windows XP of release builds of both ANSI and Unicode just to be sure. It's now been updated on the inetc plugin download page.

Originally posted by negativesir
Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.
Thanks, negativesir! I've verified that this fixes the issues with stealing focus when in silent mode and does not affect other functionality. (for the curious an Abort was switched to return false where appropriate). I wasn't sure if you'd compiled as release or debug last year, so I recompiled using a clean VC++6 install on a clean Windows XP VM of the release config of both ANSI and Unicode. I've packaged it and updated the default download on the inetc plugins page.