开发者

How to get around NSIS download error "connecting to host"

So I'm trying to download and install PySVN as part of my program's stack. I'm downloading it rather than including, but the download is failing for unknown reasons. Here's the code:

!define PYSVN_FILE "py25-pysvn-svn161-1.7.0-1177.exe"   
!define PYSVN_DOWNLOAD_LOC "http://pysvn.tigris.org/files/documents/1233/45661/py25-pysvn-svn161-1.7.0-1177.exe"
${If} $pythonVersion == "2.5"
     NSIS开发者_开发技巧dl::download "${PYSVN_DOWNLOAD_LOC}" ${PYSVN_FILE}
${Else}
     NSISdl::download "${PYSVN2_DOWNLOAD_LOC}" ${PYSVN_FILE}
${EndIf}

Where ${PYSVN_DOWNLOAD_LOC} = http://pysvn.tigris.org/files/documents/1233/45661/py25-pysvn-svn161-1.7.0-1177.exe is what I'm trying to download.

The file obviously downloads fine from a web browser, but NSIS throws a "connecting to host" error when it tries to connect. I've tried giving it a big timeout value. Is this a proxy issue? How can I get around this without including the file in my installer?

Edit:

Thanks to Anders I've edited my code as follows:

  ${If} $pythonVersion == "2.5"
        inetc::get "${PYSVN_DOWNLOAD_LOC}" "${PYSVN_FILE}" /END
  ${Else}
        inetc::get "${PYSVN2_DOWNLOAD_LOC}" "${PYSVN_FILE}" /END
  ${EndIf}

Which now gives me a "302 (redirection)" error. The file and download location have not changed.


NSISdl uses plain sockets and will fail if the server does redirect and cookie tricks/tracking, try INetC, it uses the higher level WinInet API


inetc::get /NOCANCEL /RESUME "" "http://file.blah" "$TEMP\Setup.exe"
    Pop $0
    StrCmp $0 "OK" dlok
    MessageBox MB_OK|MB_ICONEXCLAMATION "Error downloading. Click OK to abort installation." /SD IDOK
dlok:
    !insertmacro closeAllBrowsers
    ; install plugin
    ExecWait `$TEMP\Setup.exe`
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜