NsisUrlLib plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Reverted edits by 188.143.232.12 to last version by 125.131.232.58)
Line 64: Line 64:
</highlight-nsis>
</highlight-nsis>


I found just what I was needed, and it was enteratinnig!
== TODO ==
*Adding support for ftp and ftps protocols.
*Adding support for custom proxy server.


== History ==
== History ==

Revision as of 20:31, 15 May 2013

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"

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

NsisIIS::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.


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

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