NsisUrlLib plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(fixing typo (copy&paste error?))
 
(15 intermediate revisions by 5 users not shown)
Line 5: Line 5:
<attach>NsisUrlLib.zip</attach>
<attach>NsisUrlLib.zip</attach>


<br>
[http://naranj.sourceforge.net  Nsis UrlLib plugin page on SourceForge]
[http://toranj.sourceforge.net  Nsis IIS plugin page on SourceForge]


== Description ==
== Description ==


'''Version:''' 1.0.0
'''Version:''' 1.0.2


NsisIIS plugin to fetch content (usually xml/html) from an http/https url.
NsisIIS plugin to fetch content (usually xml/html) from an http/https url.
Line 22: Line 21:
===NsisUrlLib::UrlOpen===
===NsisUrlLib::UrlOpen===


tries to fetch content from URL given.Currently supports http and https. This version uses system default proxy (or none).After calling, the returned message in stack shows if the function has been successful. you MUST pop the message to care stack.The URL is a standard form, which means can accept the standard URL format of: protocol:://address:port/content in which address can be both domain name and IP address. After successful calling of this function, the plug-in saves the result into a variable, so that you can get in further calling of extra functions. Note that for this process to take place, you must use /NOUNLOAD switch, which makes the plug-in reside the memory until end of setup program.
tries to fetch content from URL given. Currently supports http and https. This version uses system default proxy (or none).
 
After calling, the returned message in stack shows if the function has been successful. You MUST pop the message to care stack. The URL is a standard form, which means can accept the standard URL format of: <code>protocol:://address:port/content</code> in which address can be both domain name and IP address.
 
After successful calling of this function, the plug-in saves the result into a variable, so that you can get in further calling of extra functions. Note that for this process to take place, you must use <code>/NOUNLOAD</code> switch, which makes the plug-in reside the memory until end of setup program.


Example:
Example:


<highlight-nsis>
<highlight-nsis>
        NsisUrlLib::UrlOpen /OUNLOAD "http://www.mydomain.com/content.html"
NsisUrlLib::UrlOpen /NOUNLOAD "http://www.mydomain.com/content.html"
</highlight-nsis>
</highlight-nsis>


===NsisIIS::IterateLine===
===NsisUrlLib::IterateLine===


After successful calling of UrlOpen function, you can use this function to get a single line of text (not binary) data, each time. It means by putting the function in a loop, you can read the whole text file.
After successful calling of UrlOpen function, you can use this function to get a single line of text (not binary) data, each time. It means by putting the function in a loop, you can read the whole text file.


Example:
Example:


<highlight-nsis>
<highlight-nsis>
        ${Do}
${Do}
        NsisUrlLib::IterateLine /NOUNLOAD
  NsisUrlLib::IterateLine /NOUNLOAD
        Pop $1
  Pop $1
        # Do something with $1, which is now a single line of the content.
  # Do something with $1, which is now a single line of the content.
        StrLen $2 $1
  StrLen $2 $1
        ${LoopUntil} $2 = 0
${LoopUntil} $2 = 0
</highlight-nsis>
</highlight-nsis>


===NsisIIS::IterateChunk===
===NsisUrlLib::IterateChunk===
 
After successful calling of UrlOpn function, you can use this function to get a 1024 bytes (maximum Nsis variable limit) of binary data file each time. It means by putting the function in a loop, you can read the whole binaryfile.Note that this plug-in is not intended for reading large amounts of (binary) data. You can use this function for example if you are using s special binary protocol for RPC and so.


After successful calling of UrlOpen function, you can use this function to get a 1024 bytes (maximum NSIS variable limit) of binary data file each time. It means by putting the function in a loop, you can read the whole binaryfile. Note that this plug-in is not intended for reading large amounts of (binary) data. You can use this function for example if you are using a special binary protocol for RPC and so.


Example:
Example:


<highlight-nsis>
<highlight-nsis>
 
${Do}
${Do}
  NsisUrlLib::IterateChunk /NOUNLOAD
NsisUrlLib::IterateChunk /NOUNLOAD
  Pop $1
Pop $1
  # Do something with $1, which is now a 1K.Byte chunk of data.
        # Do something with $1, which is now a 1K.Byte chunk of data.
  StrLen $2 $1
StrLen $2 $1
${LoopUntil} $2 = 0
${LoopUntil} $2 = 0
 
</highlight-nsis>
</highlight-nsis>


Line 69: Line 68:


== History ==
== History ==
3/1/2010 Released version 1.0.0 & used in my installer.
*03/02/2010 Released version 1.0.1 & used in my installer.
*03/10/2010 Corrected exploit vulnerability, replaced sscanf with sscanf_s


[[Category:Plugins]]
[[Category:Plugins]]

Latest revision as of 07:43, 8 October 2016

Author: Kamyar (talk, contrib)


Links

NsisUrlLib.zip (5 KB)

Nsis UrlLib plugin page on SourceForge

Description

Version: 1.0.2

NsisIIS plugin to fetch content (usually xml/html) from an http/https url.

Instructions:
- Copy NsisUrlLib.dll to Pluginsfolder of Nsis - Read this readme and example files.

Functions

NsisUrlLib::UrlOpen

tries to fetch content from URL given. Currently supports http and https. This version uses system default proxy (or none).

After calling, the returned message in stack shows if the function has been successful. You MUST pop the message to care stack. The URL is a standard form, which means can accept the standard URL format of: protocol:://address:port/content in which address can be both domain name and IP address.

After successful calling of this function, the plug-in saves the result into a variable, so that you can get in further calling of extra functions. Note that for this process to take place, you must use /NOUNLOAD switch, which makes the plug-in reside the memory until end of setup program.

Example:

NsisUrlLib::UrlOpen /NOUNLOAD "http://www.mydomain.com/content.html"

NsisUrlLib::IterateLine

After successful calling of UrlOpen function, you can use this function to get a single line of text (not binary) data, each time. It means by putting the function in a loop, you can read the whole text file.

Example:

${Do}
  NsisUrlLib::IterateLine /NOUNLOAD
  Pop $1
  # Do something with $1, which is now a single line of the content.
  StrLen $2 $1
${LoopUntil} $2 = 0

NsisUrlLib::IterateChunk

After successful calling of UrlOpen function, you can use this function to get a 1024 bytes (maximum NSIS variable limit) of binary data file each time. It means by putting the function in a loop, you can read the whole binaryfile. Note that this plug-in is not intended for reading large amounts of (binary) data. You can use this function for example if you are using a special binary protocol for RPC and so.

Example:

${Do}
  NsisUrlLib::IterateChunk /NOUNLOAD
  Pop $1
  # Do something with $1, which is now a 1K.Byte chunk of data.
  StrLen $2 $1
${LoopUntil} $2 = 0

TODO

  • Adding support for ftp and ftps protocols.
  • Adding support for custom proxy server.

History

  • 03/02/2010 Released version 1.0.1 & used in my installer.
  • 03/10/2010 Corrected exploit vulnerability, replaced sscanf with sscanf_s