[REBOL] Strange chars in the password Re:
From: allen:rebolforces at: 22-Aug-2000 23:40
----- Original Message -----
From: <[reboldes--bigfoot--com]>
To: <[list--rebol--com]>
Sent: Wednesday, August 23, 2000 12:00 AM
Subject: [REBOL] Strange chars in the password
> HI all,
>
> I need to connect to a FTP server but the password contains strange chars
like #"@" #"\" #"#"
> I tried to url-encode the password, but it does not work.
> I'm sure it was already discussed but I cannot find it.
>
> thanx for advice
> oldes
>
Hi Oldes,
This allows you to avoid that..
read [
scheme: 'ftp
user: "user-name"
pass: "password"
host: "ftp.securesite.com"
path: "private/"
target: "file.dat"
]
So that you don't have to construct that all the time, you could do use the
following code..
;---------------
config: make object! [pass: "password" user: "username"]
authenticate: func [
{Returns a filled scheme block complete with password}
url [url!] {The url to parse}
/local url-value url-obj
][
url-obj: make net-utils/url-parser []
set url-obj/vars none
url-value: url
parse/all url url-obj/url-rules
;---Return Url data set
compose [
scheme: (to-lit-word url-obj/scheme)
user: (config/user)
pass: (config/pass)
host: (url-obj/host)
path: (url-obj/path)
target: (url-obj/target)
]
]
;e.g usage
; read authenticate ftp://ftp.securesite.com/private/file.dat
; read authenticate http://www.securesite.com/private/file.dat
;------------------
Cheers,
Allen K