[REBOL] Re: Site requiring authorization
From: gscottjones:mchsi at: 13-Jun-2002 7:30
> 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"
> 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
> (see the FTP) example.
Hi, Charles (and Brett),
The method that Brett refers to avoids the need to parse the user/pass/url
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
net-utils/url-parser/user-char: union net-utils/url-parser/user-char make
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
There is some additional explanation
Again, either method can work, depending on your preference.