Using perl LWP-UserAgent results in 401 Unauthorized

Latest response

I'm working on a perl backend API client to interact with the RHEV API and had this working in 3.0, however when trying to use LWP UserAgent against the 3.1 API I get a 401 Unauthorized error. Using the same credentials with Curl works. Were there any changes in 3.1 that would affect how an API call method would change?

Responses

Hello.

Is it possible to print and post here request headers generated by your code?

I have just tried simple perl code like this with my RHEV 3.1 instance: 

 #!/usr/bin/env perl                                                             

use strict;                                                                     
use warnings;                                                                   
use LWP;                                                                        

my $ua = LWP::UserAgent->new('Mozilla');                                        
$ua->credentials("test.server.com:39272", "realm-name", 'user_name', 'some_pass');                       
my $res = $ua->get('http://test.server.com:39272/');                  

print $res->content;

There in not Authentification header in network dump but it should be. This is perl specific issue.

Is this something that has changed within RHEV 3.1? This works in 3.0

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.