in reply to Re^4: LWP and Digest Authentication
in thread LWP and Digest Authentication

No. Notice I don't call the base class's get_basic_credentials for the domain of interest, so the info I would feed to credentials would never get used.

Replies are listed 'Best First'.
Re^6: LWP and Digest Authentication
by BrowserUk (Patriarch) on Feb 11, 2009 at 04:24 UTC
      I also overloaded the constructor.
      sub new { my ($class, %options) = @_; my $user = delete $options{user}; my $passwd = delete $options{passwd}; ... my $self = $class->SUPER::new(%options); $self->{user} = $user; $self->{passwd} = $passwd; ... return $self; }

        Nowhere in any of the examples or tutorials does it show the possibility of passing userid and password to either LWP->new or LWP::UserAgent->new. The former seems to accept no parameters, and the latter is defined as taking these options:

        KEY DEFAULT ----------- -------------------- agent "libwww-perl/#.##" from undef conn_cache undef cookie_jar undef default_headers HTTP::Headers->new max_size undef max_redirect 7 parse_head 1 protocols_allowed undef protocols_forbidden undef requests_redirectable ['GET', 'HEAD'] timeout 180

        So, you've overridden & extended new() in order to pass two parameters: userid & password.

        And overridden get_basic_credentials() in order to associate those with a third parameter: realm, and maybe a fourth: url (which you pass in to get(), in order to do digest authentication.

        Ain't OOP just a wonderful!

        You know, it ain't like LWP was designed and implemented by some rank newbie.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.