Skip Menu |

This queue is for tickets about the LWP-Protocol-AnyEvent-http CPAN distribution.

Report information
The Basics
Id: 87479
Status: resolved
Priority: 0/
Queue: LWP-Protocol-AnyEvent-http

People
Owner: Nobody in particular
Requestors: pagenyon [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: v1.8.0



Subject: patch to add credentials
When making a request with userinfo, eg. http://user:pass@example.com/ , LWP converts that into an Authorization header, like 'Authorization: Basic ...'. But LWP::Protocol::AnyEvent::http doesn't handle this. Attached is a patch that calls LWP::Protocol::http's _fixup_header function to accomplish this.
Subject: creds.patch
diff --git a/lib/LWP/Protocol/AnyEvent/http.pm b/lib/LWP/Protocol/AnyEvent/http.pm index 0ea94b8..16c2cac 100644 --- a/lib/LWP/Protocol/AnyEvent/http.pm +++ b/lib/LWP/Protocol/AnyEvent/http.pm @@ -10,6 +10,7 @@ use AnyEvent qw( ); use AnyEvent::HTTP qw( http_request ); use HTTP::Response qw( ); use LWP::Protocol qw( ); +use LWP::Protocol::http qw ( ); our @ISA = 'LWP::Protocol'; @@ -87,8 +88,12 @@ sub request { my $method = $request->method(); my $url = $request->uri(); - my %headers; $request->headers()->scan(sub { $headers{ lc($_[0]) } = $_[1]; }); - my $body = $request->content_ref(); + + my $headers = $request->headers->clone(); + LWP::Protocol::http->_fixup_header($headers, $url, $proxy); + my %headers; $headers->scan(sub { $headers{ lc($_[0]) } = $_[1]; }); + + my $body = $request->content_ref(); # Fix AnyEvent::HTTP setting Referer to the request URL $headers{referer} = undef unless exists $headers{referer};
On Wed Jul 31 08:11:15 2013, pagenyon wrote: Show quoted text
> When making a request with userinfo, eg. http://user:pass@example.com/ > , LWP converts that into an Authorization header, like 'Authorization: > Basic ...'. But LWP::Protocol::AnyEvent::http doesn't handle this. > Attached is a patch that calls LWP::Protocol::http's _fixup_header > function to accomplish this.
Applied. This will be published shortly.