[REBOL] Re: Site requiring authorization
From: gscottjones:mchsi at: 13-Jun-2002 7:30
<<Reformatted>>
> From: "Charles"
> > Greetings folks. I try downloading a file through
> > HTTP from REBOL/Core.
> > Thing is, I get a 401 auth required error. How can
> > I get around this? When I grab the file with IE, it
> > pops up a dialog box asking for user and password.
> > In my case, the user is the email address. For instance:
> > user: [me--site--dom]
> > pwd: fubar
> > file: http://www.site.dom/file.bin
> >
> > So I want to write/binary %somedir/data.bin
> > read/binary file .. but get 401.
> > Any info folks? Thanks!
From: "Brett Handley"
<snip>
> Have a look at http://www.rebol.com/docs/core23/rebolcore-13.html#sect2.2.
>
> You will probably need to use the READ [...] format, specifying username
and
> password
> (see the FTP) example.
Hi, Charles (and Brett),
The method that Brett refers to avoids the need to parse the user/pass/url
request:
read [
scheme: 'FTP
host: "ftp.example.com"
port-id: 8000
target: %/file.txt
user: "bill"
pass: "vbs"
]
The problem is that the current url parse rule does not recognize the "@"
symbol as part of a valid user name. An alternative to Brett's suggestion
is to patch the character set by adding "@" as being valid (watch for line
wrap).
net-utils/url-parser/user-char: union net-utils/url-parser/user-char make
bitset! #"@"
With this patch you (hopefully) would be able to do something like:
write/binary read http://[me--site--dom]:[fubar--www--site--dom]/file.bin
%somedir/data.bin
There is some additional explanation
http://www.escribe.com/internet/rebol/m10936.html
Again, either method can work, depending on your preference.
Regards,
--Scott Jones