NSIs download plug-in

Source: Internet
Author: User

Inetc plug-infrom NSIs Wiki

Author: Takhir (talk, contrib)


Contents

[Hide]

  • 1 Links
  • 2 Description
  • 3 command line
    • 3.1 get DLL Function
    • 3.2 Post DLL Function
    • 3.3 head DLL Function
    • 3.4 put DLL Function
  • 4 Examples
  • 5 Credits
[Edit] links

Download:
Inetc.zip (55 KB)

Forum Thread

[Edit] 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 compared to nsisdl plug-in. command Line may include few URL/file pairs to be transfered. if server or proxy login/password are not set in the script, it displays ie-style Authentication Dialog (Login T silent mode ). plug-in supports 3 "Transfer in progress" display modes:

  1. Old nsisdl style-Additional embedded progress bar and text on the instfiles page;
  2. Popup dialog mode with detailed info;
  3. 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. for FTP use "host/path" for file location relative to user's home Dir and "host // path" for absolute path.

[Edit] command line

Plug-in DLL Functions (Entry Points): Get, post, head, put

[Edit] Get DLL Function
inetc::get [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD] [/NOPROXY] [/NOCANCEL] [/TIMEOUT INT_MS] [/SILENT] [/CAPTION TEXT] [/RESUME RETRY_QUESTION] [/POPUP HOST_ALIAS | /BANNER TEXT] [/CANCELTEXT CANCEL_TEXT] [/QUESTION CANCEL_QUESTION] [/USER_AGENT USER_AGENT_TEXT] [/HEADER HEADER_TEXT] [/TRANSLATE LANG_PARAMS] URL1 local_file1 [URL2 local_file2 [...]] [/END]

This call returns "OK" string if successful, error description string if failed (see supported inetload. CPP file for a full set of status strings ). usage and result processing samples are encoded 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)
/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 ). if host_alias is not "", text will replace URL in the dialog-This allows to hide real URL (including password ).
/Banner
Displays simple popup Dialog (MSI banner mode) and sets dialog text (up to 3 lines using $/N ).
/Canceltext
Text for the cancel button in the nsisdl mode. Default is NSIs dialog cancel button text (current Lang ).
/Question
Text for the optional MessageBox if user tries to cancel download. If/question "" was used default "are you sure that you want to stop download? "Will be substituted.
/Useragent
Useragent HTTP request header value. Default is "nsis_inetc (Mozilla )".
/Header
Adds or replaces HTTP Request Header. Common header_text format is "header: value ".
/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.
[Edit] Post DLL Function
inetc::post TEXT2POST [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN  /PASSWORD PROXY_PASSWD] [/NOPROXY] [/NOCANCEL] [/TIMEOUT INT_MS] [/SILENT] [/FILE]  [/CAPTION TEXT] [/POPUP HOST_ALIAS | /BANNER TEXT] [/CANCELTEXT CANCEL_TEXT] [/USER_AGENT USER_AGENT_TEXT] [/TRANSLATE LANG_PARAMS] URL1 local_file1 [URL2 local_file2 [...]] [/END]

Sets post http mode and defines text string or file name to be used in the post (HTTP only ). disables auto re-Get. NO char replaces used (% 20 and others ). /file option allows to send text2post file content to server, additional 'filename: 'header added to request this case.

[Edit] Head DLL Function

The same as get, but requests HTTP headers only. Writes raw headers to file.

[Edit] Put DLL Function
inetc::put [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD] [/NOPROXY] [/NOCANCEL] [/TIMEOUT INT_MS] [/SILENT] [/CAPTION TEXT] [/POPUP HOST_ALIAS | /BANNER TEXT]  [/CANCELTEXT CANCEL_TEXT] [/USER_AGENT USER_AGENT_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.

[Edit] 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  Abortdlok:  ...
;installer window restoring after silent calls from .onGUIInit;by Edward Marshall & Jonathan Beddoes;temporarily makes the installer window topmost so that inetc doesn't drop our focus Function .onGUIInit   ; Get window handle of installer into register 0.  ; This only works in onGUIInit! (so you still can't silently call inetc from onInit)  StrCpy $0 $HWNDPARENT   ; Make window always-on-top. Yes, this is bad but we are only doing it temporarily!  ; This prevents inetc's hidden dialog from getting foreground precedence over the installer.  ; This must be done before any inetc calls.  ; -1 = HWND_TOPMOST, 3 = SWP_NOSIZE|SWP_NOMOVE  System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"   ; Now do whatever you want with inetc.  inetc::head /silent "http://ineum.narod.ru/spr_2006.htm" "$EXEDIR/head.txt"   ; Now set the installer window back to normal (not always-on-top).  ; -2 = HWND_NOTOPMOST, 3 = SWP_NOSIZE|SWP_NOMOVE  System::Call "user32::SetWindowPos(i r0, i -2, i 0, i 0, i 0, i 0, i 3)" FunctionEnd
; Following attribute also can restore installer Window; BGGradient 000000 000080 FFFFFF

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.