Old 7th November 2004, 16:11   #1
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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.
Attached Files
File Type: zip inetload.zip (11.1 KB, 2302 views)
Takhir is offline   Reply With Quote
Old 8th November 2004, 05:57   #2
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
wording improved
Attached Files
File Type: zip inetload.zip (11.1 KB, 1414 views)
Takhir is offline   Reply With Quote
Old 9th November 2004, 07:43   #3
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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.
Attached Files
File Type: zip inetload.zip (12.3 KB, 9105 views)
Takhir is offline   Reply With Quote
Old 11th November 2004, 15:22   #4
Fred556
Guest
 
Posts: n/a
Can this plugin download silent and with process?

can can shellexecute it.

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

Thanks...
  Reply With Quote
Old 11th November 2004, 17:52   #5
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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.
Takhir is offline   Reply With Quote
Old 11th November 2004, 19:46   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 11th November 2004, 20:28   #7
grahama
Senior Member
 
Join Date: Sep 2004
Location: Los Angeles
Posts: 223
yea
I am having a lot of problems with corporate networks using proxy settings
a new NSISdl would be fantastic
g
grahama is offline   Reply With Quote
Old 12th November 2004, 12:44   #8
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Quote:
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.
Attached Files
File Type: zip inetload.zip (10.2 KB, 1131 views)
Takhir is offline   Reply With Quote
Old 13th November 2004, 09:14   #9
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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.
Attached Files
File Type: zip inetload.zip (12.4 KB, 1343 views)
Takhir is offline   Reply With Quote
Old 13th November 2004, 12:16   #10
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
I fixed one bug in last (extended) version and improved download status displaying.
Attached Files
File Type: zip inetload.zip (12.5 KB, 1232 views)
Takhir is offline   Reply With Quote
Old 14th November 2004, 20:56   #11
grahama
Senior Member
 
Join Date: Sep 2004
Location: Los Angeles
Posts: 223
is inetload working with proxy networks...or is that a future thing ?
g
grahama is offline   Reply With Quote
Old 15th November 2004, 08:18   #12
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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 .
Attached Files
File Type: zip inetload.zip (12.7 KB, 1155 views)
Takhir is offline   Reply With Quote
Old 15th November 2004, 19:47   #13
grahama
Senior Member
 
Join Date: Sep 2004
Location: Los Angeles
Posts: 223
will do and report back...

g
grahama is offline   Reply With Quote
Old 15th November 2004, 20:57   #14
grahama
Senior Member
 
Join Date: Sep 2004
Location: Los Angeles
Posts: 223
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
grahama is offline   Reply With Quote
Old 15th November 2004, 23:53   #15
grahama
Senior Member
 
Join Date: Sep 2004
Location: Los Angeles
Posts: 223
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
grahama is offline   Reply With Quote
Old 16th November 2004, 10:55   #16
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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.
Takhir is offline   Reply With Quote
Old 17th November 2004, 07:48   #17
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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:
...
Attached Files
File Type: zip inetload.zip (12.8 KB, 1189 views)
Takhir is offline   Reply With Quote
Old 17th November 2004, 19:44   #18
grahama
Senior Member
 
Join Date: Sep 2004
Location: Los Angeles
Posts: 223
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
grahama is offline   Reply With Quote
Old 18th November 2004, 18:17   #19
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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".
Takhir is offline   Reply With Quote
Old 18th November 2004, 18:42   #20
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 19th November 2004, 11:57   #21
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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.
Attached Files
File Type: zip inetload.zip (13.3 KB, 1160 views)
Takhir is offline   Reply With Quote
Old 19th November 2004, 12:05   #22
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 19th November 2004, 12:34   #23
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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?
Takhir is offline   Reply With Quote
Old 19th November 2004, 12:37   #24
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The dialog area is free when a plug-in is called inside a custom page callback function.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 21st November 2004, 16:57   #25
grahama
Senior Member
 
Join Date: Sep 2004
Location: Los Angeles
Posts: 223
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...
grahama is offline   Reply With Quote
Old 24th November 2004, 19:40   #26
grahama
Senior Member
 
Join Date: Sep 2004
Location: Los Angeles
Posts: 223
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
grahama is offline   Reply With Quote
Old 14th December 2004, 18:13   #27
Jnuw
Senior Member
 
Join Date: Sep 2004
Location: Wisconsin, US
Posts: 258
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.
Jnuw is offline   Reply With Quote
Old 15th December 2004, 11:08   #28
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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).
Attached Files
File Type: zip inetload.zip (13.4 KB, 1162 views)
Takhir is offline   Reply With Quote
Old 15th December 2004, 16:33   #29
Jnuw
Senior Member
 
Join Date: Sep 2004
Location: Wisconsin, US
Posts: 258
SUCCESS!! Your new inetload cut right through my company's proxy! Thank you so much Takhir.
Jnuw is offline   Reply With Quote
Old 15th December 2004, 22:14   #30
Jnuw
Senior Member
 
Join Date: Sep 2004
Location: Wisconsin, US
Posts: 258
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!
Jnuw is offline   Reply With Quote
Old 16th December 2004, 09:13   #31
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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?
Takhir is offline   Reply With Quote
Old 16th December 2004, 14:43   #32
Jnuw
Senior Member
 
Join Date: Sep 2004
Location: Wisconsin, US
Posts: 258
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.
Jnuw is offline   Reply With Quote
Old 16th December 2004, 16:29   #33
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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.
Attached Files
File Type: zip inetload.zip (13.4 KB, 1113 views)
Takhir is offline   Reply With Quote
Old 16th December 2004, 18:25   #34
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
extra->exec_flags->silent != 0 is the most reliable way to detect silent installers. That is what NSIS itself uses.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 17th December 2004, 05:43   #35
grahama
Senior Member
 
Join Date: Sep 2004
Location: Los Angeles
Posts: 223
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
grahama is offline   Reply With Quote
Old 17th December 2004, 07:28   #36
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
I'll think about command line switch to support both modes
Takhir is offline   Reply With Quote
Old 17th December 2004, 11:01   #37
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
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
Afrow UK is offline   Reply With Quote
Old 18th December 2004, 05:56   #38
mrtech
Junior Member
 
Join Date: Oct 2002
Posts: 46
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.
mrtech is offline   Reply With Quote
Old 18th December 2004, 09:24   #39
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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).
Attached Files
File Type: zip inetload.zip (17.1 KB, 1461 views)
Takhir is offline   Reply With Quote
Old 18th December 2004, 12:44   #40
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Attached Images
File Type: png temp.png (571 Bytes, 1763 views)
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

Forum Jump