AnyEvent::HTTP and basic authentication

Ian Stuart Ian.Stuart at ed.ac.uk
Tue Feb 1 17:33:20 CET 2011


"The caller is responsible for authentication management" - does anyone 
have any examples of managing basic authentication with AnyEvent::HTTP?

Neither
     http_request(

         # the main request we want to make
         "POST", 'http://'.$username.":".$password."@".$host.$path,

         # the body of the http_request
         body => $archive,

         $cv
     );

or
     my $auth = "Basic ".MIME::Base64::encode("$username:$password", '');
     my %headers = (
         'Authorization'       => $auth,
                   );
     # this is a long call, intersperced with comments!
     http_request(

         # the main request we want to make
         "POST", "http://'.$host.$collection,

         # the body of the http_request
         body => $archive,

         # the headers for that request
         headers => \%headers,

         $cv
     );

work....
(credentials proven to work using LWP::UserAgent)

-- 

Ian Stuart.
Developer: Open Access Repository Junction and OpenDepot.org
Bibliographics and Multimedia Service Delivery team,
EDINA,
The University of Edinburgh.

http://edina.ac.uk/

This email was sent via the University of Edinburgh.

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.




More information about the anyevent mailing list