Reputation: 21
So I've been trying to get the Inetc plugin for NSIS to download the zip file mp3splitter20.zip from the following address http://www.hjhappel.de/dlmonitor/download.php?t=d&i=2 but I'm having no luck. I tried the Nsisdl plugin earlier and got the file to begin downloading but I kept getting the following error
download failed: server did not specify content length
I read it would be a better idea to use Inetc, as it allows for use of HTTP1.1. I tried my best to understand the documentation at the NSIS inetc wiki page here, but I'm at a loss as to how I'm supposed to incorporate the required PHP commands through the HEADER to download my zip file. Now when I try to use the header I get the following error:
Download Failed: Connection Error
which leads me to believe I'm making a very simple error.
A nudge to some examples or the appropriate NSIS PHP documentation would be greatly appreciated. Thanks in advance and Cheers
Here is the section of the code that I'm trying to get working.
!define file_name "mp3splitter20.zip"
!define file_size "294KB"
Section "F7immersion"
SetOutPath $INSTDIR
;these files must be in the main folder
inetc::get /HEADER 'Content-type: application/zip' 'Content-Disposition: attachment; filename="'${file_name}.'"' "Content-length: ${file_size}" "http://www.hjhappel.de/dlmonitor/download.php?t=d&i=2" "$INSTDIR\mp3splitter20.zip" /END
Pop $R0 ;Get the return value
StrCmp $R0 "success" +3
MessageBox MB_OK "Download failed: $R0"
Quit
nsisunz::Unzip "$INSTDIR\mp3splitter20.zip" "$INSTDIR"
Pop $R0
StrCmp $R0 "success" +2
DetailPrint "$R0" ;print error message to log
File /r *.ahk
File /r *.txt
File /r *.nsi
File /r *.exe
File /r *.ico
File /r *.ini
SectionEnd
Upvotes: 0
Views: 1305
Reputation: 101569
You should not be sending those headers in a request, the server will send those in the reply. (See List of HTTP header fields)
To download a file from a "normal" server all you need is inetc::get "http://example.com/somefile.xyz" "$instdir\thefile.xyz" /END
Upvotes: 1