WWW::Mechanize and NTLM authentication

From: e r m (erwinrm_at_gmail.com)
Date: 12/21/04

  • Next message: e r m: "Re: Cygwin and SSL"
    Date: 21 Dec 2004 14:55:49 -0800
    
    

    I'm having problems with a script to verify if a web app is up and
    running. I initially received http code 401, which I believe is due to
    NTLM authentication. After searching through CPAN, I came across the
    example in LWP::Authen::Ntlm.

    I've modified my code by adding keep_alive, and calling credentials, as
    follows:
    # Set up the mech.
    my $mech1 = WWW::Mechanize->new( autocheck=>1, keep_alive=>1 );
    $mech1->agent_alias( 'Windows IE 6' );
    print "Setting up credentials\n";
    $mech1->credentials($web_addr, '', $domain1\\$userid1, $pswd1);

    # Try to get the login page.
    print "Getting the url - $web_addr \n";
    $mech1->get( $web_addr );

    Here's the output with debug on:
    Setting up credentials
    Getting the url - http://app.group.com
    LWP::UserAgent::request: ()
    HTTP::Cookies::add_cookie_header: Checking app.group.com for cookies
    HTTP::Cookies::add_cookie_header: Checking .group.com for cookies
    HTTP::Cookies::add_cookie_header: Checking group.com for cookies
    HTTP::Cookies::add_cookie_header: Checking .com for cookies
    LWP::UserAgent::send_request: GET http://app.group.com
    LWP::UserAgent::_need_proxy: Not proxied
    LWP::Protocol::http::request: ()
    LWP::Protocol::collect: read 811 bytes
    LWP::Protocol::collect: read 1896 bytes
    LWP::Protocol::collect: read 1724 bytes
    LWP::UserAgent::request: Simple response: Unauthorized
    LWP::Authen::Ntlm::authenticate: authenticate() has been called
    Use of uninitialized value in exists at
    /mydir/usr/local/perl5/lib/site_perl/5.8.5/LWP/UserAgent.pm line 566.
    LWP::Authen::Ntlm::authenticate: No username and password available
    from get_basic_credentials(). Returning unmodified response object
    Error GETing http://app.group.com: Access Denied at ping-share.pl line
    139

    Any help would be appreciated.


  • Next message: e r m: "Re: Cygwin and SSL"