augy
20th July 2004 23:59 UTC
http/1.1 400 bad request with NSISdl
I get the "http/1.1 400 bad request" error string whenever I try a particular download:
NSISdl::download "http://www.domainprotected.net/$CurInstallClient_Update/eCM for $CurInstall.exe" "$Path\$CurInstall\eCM for $CurInstall.exe"
as you may have guessed, $CurInstall and $Path are both user variables. I've checked the strings with messageboxes already--they expand out properly at runtime. It's particularly difficult to figure out the problem because I do another download right after this one:
NSISdl::download "http://www.domainprotected.net/$CurInstallClient_Update/reg/UpdatedRegistryFile.reg" $Path\UpdatedRegistryFile.reg
and it also expands out just fine with messagebox AND it downloads correctly.
Please note that I don't actually receive any error message popup; I only get the message if I pop it off the stack and messagebox it. I would assume that the error message it trying to tell me that the file is nonexistent, but I've checked the path over and over and over again (it's been about a week, and the boss is getting irritated =D) to no avail. The program seems to just skip over it; it blips the downloading dialog and then moves on to the next download.
Oh, and this isn't an installer per se; it's actually an updater for a program installed with NSIS, so there's no $INSTDIR or anything; however, $Path contains the path to the installation directory, pulled out of the registry.
So, any ideas?
Thanks alot,
augy
deguix
21st July 2004 11:40 UTC
Remember that $CurInstallClient_Update is considerated one variable, so the value of $CurInstall is ignored. To solve this you need to use a common (or constant) variable (like $0), put the variable you want in it and concatenate the string into it. Like this below:
StrCpy $0 $CurInstall
StrCpy $0 $0Client_Update
NSISdl::download "http://www.domainprotected.net/$0/eCM for $CurInstall.exe" "$Path\$CurInstall\eCM for $CurInstall.exe"
Which means one more thing to go to the documentation:
"When you concatenate user variables with strings and there is no separation by a space, you need to use a common variable like $0, set the value of this constant variable with the user variable's, then you concatenate with a string and use it."
augy
21st July 2004 23:28 UTC
"Remember that $CurInstallClient_Update is considerated one variable, so the value of $CurInstall is ignored"
Well, this isn't true--When I messagebox, the string looks fine, and the second NSISdl::download I have listed works just fine, and it uses the user variables in the same way. Is there anything else that may be causing it?
augy
iceman_k
22nd July 2004 02:56 UTC
Perhaps its the spaces in "http://www.domainprotected.net/$CurInstallClient_Update/eCM for $CurInstall.exe" or the spaces in "$Path\$CurInstall\eCM for $CurInstall.exe"?
Did you try:
"http://www.domainprotected.net/$CurInstallClient_Update/eCM%20for%20$CurInstall.exe"
or '"$Path\$CurInstall\eCM for $CurInstall.exe"' or a combination of the two?