0

Hello again.
I was trying to login to my web server protected with basic auth, and after i understood that it would be nice to automatically detect the realm so now i want to know on how to do so.
Thanks in advance.

1
Contributor
2
Replies
5
Views
7 Years
Discussion Span
Last Post by jen140
0

Sorry if i didnt expleined me well.
I have the next code :

use LWP::UserAgent;
my $browser = LWP::UserAgent->new;
$browser->agent('localbot');
$browser->credentials(
'127.0.0.1:80',
'testing',#<- the $realm
'admin' => 'password');

my $response = $browser->get('http://127.0.0.1/');
if($response->status_line eq '200 OK')
{
print $response->decoded_content;
}

And i want that the $realm be detected automatically.

Edited by jen140: n/a

0

Ok, found the solution, i can get it with:
print $response->header("WWW-Authenticate");

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.