A bit more info. In webrat.log, I've got:
D, [2009-11-23T14:14:06.042501 #12946] DEBUG -- : REQUESTING PAGE: GET
https://gator1087.hostgator.com/~tes/admin/ with {} and HTTP headers
{"HTTP_AUTHORIZATION"=>"Basic dGVzOnRvdGFsZXF1aXR5MQ==\n"}
I'm not sure what "Basic dGVzOnRvdGFsZXF1aXR5MQ==\n" means at the end
of the log message. Is that a hash of the username and password. Is
something supposed to be on the right side of the '=='? All I can
find on the subject is this:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8.
What is the request header supposed to look like?
On Nov 22, 8:44 pm, lsiden <
lsi...@gmail.com> wrote:
> I need to get Webrat::Mechanize to log onto a site that returns a 403
> even when you go to the welcome page (it's not for the general public,
> but the client must use a shared-hosting site).
>
> First I attempted to use the login form but that did not work, because
> Webrat does not create a scope object when it sees the 403, even when
> there is content.
>
> Martin Emde already recommended on the forum that I try basic
> authentication. I tried doing it like this:
>
> ... do |site, user, pwd|
> basic_auth(user, pwd)
> visit site
> ...
> end
>
> but it throws an exception:
>
> 403 => Net::HTTPForbidden (WWW::Mechanize::ResponseCodeError)
>
> I suppose I would see this if I were passing an invalid username and/
> or password, but I already double-checked this manually in the browser
> and I'm passing the right credentials.
>
> I'm obviously doing something wrong, but I need an example to go on.
> Can anyone point me to an example?