Archive: NSISdl again...


NSISdl again...
  Is there a way to pass username\pass info to NSISdl so it can authenticate on a server?If not this would be a handy feature.This seems like it should be a basic feature.

the usernamepassword@blahblah

mentioned in the docs doesnt work.


You can try to download via FTP.

http://forums.winamp.com/showthread....hreadid=186466


no im not downloading from an ftp..so this isnt an option.thxz though.


mmm, did you try something like:


StrCpy $0 "user"
StrCpy $1 "pwd"

NSISdl::download "http://www.server.com/base.php?user=$0&pass=$1" ...

yep thxz though.seems the plugin just cant handle it.


has no one used this tool to download from a server that requires authorization? can ie cookie data be used somehow?


Here you go:

use NSISdl to download to a file like so:
NSISdl::download /TIMEOUT=10000 "www.someurl.com?u=$1&p=$2" "$INSTDIR\result.txt"

Pop $0
#MessageBox MB_OK "result=$0"
StrCmp $0 success success
SetDetailsView show
DetailPrint "download failed: $0"
# MessageBox MB_ICONEXCLAMATION|MB_OK "download failed: $0"
MessageBox MB_ICONEXCLAMATION|MB_OK "The installer was not able to register/log you in."
Pop $1
Pop $0
GoTo finished
#Abort

--then check the result by reading in the file, in this case result.txt ->

success:

FileOpen $2 "$INSTDIR\result.txt" "r"
FileRead $2 $1 ;read line one into $1
FileClose $2
Delete "$INSTDIR\result.txt"

IntCmp $1 0 finished +1 not_authenticated
MessageBox MB_ICONEXCLAMATION|MB_OK "The username you have chosen is already registered."
Abort


If you're using PHP, I seem to remember you need to specify the Content header length for it to work.

This should help you:


<?php

ob_start();
>?>
>
...output page contents as usual...

<?php
># Make a Content-Length: header
>header('Content-Length: ' . ob_get_length());

>ob_end_flush();
>?>
-Stu

ah thxz but "content header length" isnt the problem.I just need to be able to get it to authorize at the server...would be nice if cookie data could be used somehow...or if user\pass data could be sent in the url which it cant be it seems.


Downloading http://user:password@server/file works fine for me.


what if server requires something other than "user" "pass".

if it requires "username" password" or some other VARIABLE then what?

some versatallity would be nice to add maybe.


Huh? Do you have an example? I don't understand what you want.


my point is can we use IE cookie data since user/pass doesnt work on all servers...which it does not.Period.otherwise i wouldnt be here.ive used NSISdl for quite some time with success except for this.


I still don't understand which kind of authorization you want. I need an example. I can't help you without knowing the authorization method you're looking for. From your first message it looked like you wanted what I've first suggested, but then you started talking about variables which seems to suggest you're looking for what Lobo, j27lee and Afrow suggested. Can you specify exactly what you're looking for? An example will be most helpful.


hmm i dont know how i can make this clearer...user\pass doesnt work for me because the server im dl from doesnt request "user"\"pass".It requires data availiable from cookies(which we seem to be avoiding)or other things such as "blahblahmember"/"blahblahpass" which i cant seem to send in a url.


OK, so it's cookies you want. NSISdl doesn't support cookies nor does it use Internet Explorer's cookies data. NSISdl only uses proxy information from Internet Explorer's registry key.


ok well i guess ill just have to fix the plugin again(like i did for the content header length)thxz anyways..but just as a suggestion,the plugin should be more versatile.In it's current state it's very limited.1) you shouldnt get a failed dl just because the plugin cant get the size of the file for "dialogs".
2)It should be more versatile to dl from more than just the simplest server set-ups.NSIS is an awesome tool,too bad it's hobbled by a weak dl plugin.thxz anyways.