in reply to Forcing LWP authentication

Send the Authorization header with every request. You don't have to wait for the server to challenge you (and for those of you who think that, recall that HTTP is a stateless protocol). From RFC 2616, Section 14.8 (I added the emphasis):

A user agent that wishes to authenticate itself with a server--usually, but not necessarily, after receiving a 401 response--does so by including an Authorization request-header field with the request.

You don't have to force LWP to do it; it sounds like the ATOM client needs to know to do it.

It's difficult to point to any concrete fixes without code though.

Update: added the extract from RFC 2616

--
brian d foy <brian@stonehenge.com>
Subscribe to The Perl Review

Replies are listed 'Best First'.
Re^2: Forcing LWP authentication
by drewbie (Chaplain) on Oct 23, 2006 at 13:45 UTC
    Thanks for the replies so far. In my case, I'm using RT::Client (not sure if it's on CPAN - I think $work paid Best Practical to write it). It uses a custom LWP UserAgent class so it (hopefully) should be straightforward to add a header on outgoing requests. Now I just need to dive into LWP to figure out how to set headers.
    my $rv = $self->SUPER::new(%args); $rv->ua( LWP::UserAgent::RTClient->new($rv) ); $rv->ua->{keep_alive} = 1; $rv->ua->{requests_redirectable} = [ qw( GET HEAD OPTIONS ) ];
    Thanks,
    Drew