1

How do I make an asynchronous GET request to URL like http://www.example.com/somepage?param1=val1&param2=val2 in NSIS. I don;t care about response - all I want is make a request and disregard response (so not for downloading files).

Currently I use inetc plugin, however it is less than optimal for 2 reasons:

  1. It is blocking (not asynchronous), resulting in installation "mini-hangs"
  2. It needs output file, which is really not necessary and serves no purpose for my needs.

So, is there a way to make async web requests from NSIS?

Fit Dev
  • 3,413
  • 3
  • 30
  • 54

1 Answers1

3

You could try the InetBgDL plug-in but you are still stuck with having to deal with the output file. You can just dump those into $pluginsdir...

Anders
  • 97,548
  • 12
  • 110
  • 164
  • Thanks for a quick response. That's a nice tiny plugin! A few questions: 1) Can it be called several times? 2) Is it non-blocking? 3) Documentation says "/RESET must be used if status $0 > 299, it can also be used to abort all active downloads." So if the server returns 503 error code for example... will it somehow affect install? – Fit Dev Jun 12 '15 at 12:52
  • 1
    1) Yes 2) Yes (A queue is used and only one web request is active, only the NSIS side is async) 3) /RESET just stops the background downloader thread if any and then resets the count & size stats you can retrieve with GetStats. If you don't care about the response code nor the output you can just fire and forget... – Anders Jun 12 '15 at 13:05
  • BTW Just noticed that Comodo Firewall does not bring a prompt on Windows 8.1 as it did for inetc, and the requests do not go through. It works ok on plain Windows 8.1 though. Any idea why this plugin would behave differently than inetc with some firewalls? – Fit Dev Jun 12 '15 at 14:03
  • 1
    They both use the WinInet API internally but they might not use the exact same flags or maybe INetC is whitelisted, I don't know... – Anders Jun 12 '15 at 15:52