Inetc plug-in: Difference between revisions
No edit summary |
No edit summary |
||
Line 102: | Line 102: | ||
... | ... | ||
</highlight-nsis> | </highlight-nsis> | ||
== Credits == | |||
Many thanks to Backland how offered a simple way to fix NSISdl mode crashes and added 'center parent' function. | |||
[[Category:Plugins]] | [[Category:Plugins]] |
Revision as of 14:17, 7 September 2006
Author: Takhir (talk, contrib) |
Links
Download:
Inetc.zip (81 KB)
Description
Internet client plug-in for files download and upload. Based on the InetLoad plug-in. Network implementation uses MS WinInet API, supports http/https and ftp protocols. Plugin has better proxy support compare to NSISdl plug-in. Command line may include few URL/File pairs to be transfered. If server or proxy login/password are not setten in the script, displays IE-style authentication dialog (except silent mode). Plug-in supports 3 "transfer in progress" display modes:
- old NSISdl style - additional embedded progress bar and text on the INSTFILES page;
- POPUP dialog mode with detailed info;
- BANNER mode with simple popup window.
Plug-in recognizes Installer's Silent mode and this case hides any output (this feature requires NSIS 2.03 or later). Program implements simple re-get functionality - host reconnect and download from current position after short pause. While program depends on IE settings, it changes current IE mode to online. NSISdl code fragment was used for progress bar displaying in the "old style" mode.
Command line
Plug-in DLL functions (entry points): get, head, put
get DLL Function
inetc::get [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD] [/NOPROXY] [/NOCANCEL] [/POST TEXT2POST] [/TIMEOUT INT_MS] [/SILENT] [/RESUME RETRY_QUESTION] [/CAPTION TEXT] [/POPUP | /BANNER TEXT] [/TRANSLATE LANG_PARAMS] URL1 local_file1 [URL2 local_file2 [...]] [/END]
This call returns "OK" string if successful, error description string if failed (see included InetLoad.cpp file for a full set of status strings). Usage and result processing samples are included to the package.
- /PROXY
- Overwrites current proxy settings, not required in most cases. IE settings will be used by default.
- /USERNAME
- Proxy username (http only).
- /PASSWORD
- Proxy password (http only). For server (http/ftp) authentication it is possible to use URL encoded name and password, for example http://username:password@nsis.sourceforge.net.
- /NOPROXY
- Disables proxy settings for this connection (if any)
- /NOCANCEL
- Prevents download from being interrupted by user (locks Esc, Alt-F4, Cancel handling)
- /POST
- Sets POST http mode and defines text string to be used in the POST (http only). Disables auto re-get. No char replaces used (%20 and others).
- /TIMEOUT
- Sets INTERNET_OPTION_CONNECT_TIMEOUT, milliseconds, default - IE current parameter value.
- /SILENT
- Key hides plug-in' output (both popup dialog and embedded progress bar). Not required if 'SilentInstall silent' mode was defined in script (NSIS 2.03 or later).
- /RESUME
- On the permanent connection/transfer error instead of exit first displays message box with "resume download" question. Useful for dial-up connections and big files - allows user to restore connection and resume download. Default is "Your internet connection seems to have dropped out!\nPlease reconnect and click Retry to resume downloading...".
- /CAPTION
- Defines caption text for /BANNER mode, caption prefix (left of '-') for /POPUP mode and caption for RESUME MessageBox. Default is "InetLoad plug-in" if not set or "".
- /POPUP
- This mode displays detailed download dialog instead of embedded progress bar. Also useful in .onInit function (i.e. not in Section).
- /BANNER
- Displays simple popup dialog (MSI Banner mode) and sets dialog TEXT (up to 3 lines using $\n).
- /END
- Allows to limit plug-in stack reading (optional, required if you stores other vars in the stack).
- /TRANSLATE
- Allows translating plug-in text in the POPUP or "old style" (NSISdl) modes (see Readme for parameters). In the BANNER mode text is also customizable.
head DLL Function
The same as get, but requests http headers only. Writes raw headers to file.
put DLL Function
inetc::put [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD] [/NOPROXY] [/NOCANCEL] [/TIMEOUT INT_MS] [/SILENT] [/CAPTION TEXT] [/POPUP | /BANNER TEXT] [/TRANSLATE LANG_PARAMS] URL1 local_file1 [URL2 local_file2 [...]] [/END]
Return value and parameters (if applicable) are the same as for previous entry point.
Examples
inetc::get "http://dl.zvuki.ru/6306/mp3/12.mp3" "$EXEDIR\12.mp3" \ "ftp://dl.zvuki.ru/6306/mp3/11.mp3" "$EXEDIR\11.mp3" Pop $0
inetc::put /BANNER "Cameron Diaz upload in progress..." \ "http://www.dreamgirlswallpaper.co.uk/fiveyearsonline/wallpaper/Cameron_Diaz/camerond09big.JPG" \ "$EXEDIR\cd.jpg" Pop $0 StrCmp $0 "OK" dlok MessageBox MB_OK|MB_ICONEXCLAMATION "http upload Error, click OK to abort installation" /SD IDOK Abort dlok: ...
Credits
Many thanks to Backland how offered a simple way to fix NSISdl mode crashes and added 'center parent' function.