Skip Menu |

This queue is for tickets about the Net-Async-HTTP CPAN distribution.

Report information
The Basics
Id: 75830
Status: resolved
Priority: 0/
Queue: Net-Async-HTTP

People
Owner: Nobody in particular
Requestors: mthode [...] mthode.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.16
Fixed in: 0.17



Subject: custom headers and async http failing
an example request request => HTTP::Request->new( "DELETE" => $fulluri, [ 'X-Auth-Token' => $authtok ] ) I think the error is that $req->protocol is not defined This paste is my code that generates the error (the x-auth-token bit doesn't seem to be needed http://dpaste.com/hold/717566/ If you want me to test stuff let me know
From: mthode [...] mthode.org
On Fri Mar 16 19:01:29 2012, prometheanfire wrote: Show quoted text
> an example request > > request => HTTP::Request->new( "DELETE" => $fulluri, [ 'X-Auth-Token' => > $authtok ] ) > > I think the error is that $req->protocol is not defined > > This paste is my code that generates the error (the x-auth-token bit > doesn't seem to be needed > > http://dpaste.com/hold/717566/ > > If you want me to test stuff let me know
Looks like manually specifying this fixed it $req->protocol('HTTP/1.1'); while ($running < $MAX) { my $file = shift @objlist; #my $fulluri = "$storageurl/$container/$file"; my $fulluri = "/v1/$tenantId/$container/$file"; print "$fulluri\n\n\n"; my $req = HTTP::Request->new( DELETE => "$fulluri", [ 'X-Auth-Token' => $authtok ] ); $req->protocol('HTTP/1.1'); #$req->header(Host => '173.203.3.30'); #$req->header(Connection => 'Keep-Alive'); $http->do_request( request => $req, host => "173.203.3.30", SSL => TRUE, on_response => sub { if ($is_verbose) { my ( $response ) = @_; #$response->as_string =~ s/^/| /mg; print ",", '-' x 78, "\n"; print $response->as_string; print "`", '-' x 78, "\n"; } $running--; }, on_error => sub { #print "error deleteing $fulluri\n"; }, ); $running++; }
Ah, oops yes. All the unit tests specifically set protocol before they start. I'll make some that don't so I can test and fix this. -- Paul Evans
Attached patch should fix it. Will be in next release. -- Paul Evans
Subject: rt75830.patch
=== modified file 'lib/Net/Async/HTTP/Protocol.pm' --- lib/Net/Async/HTTP/Protocol.pm 2012-02-29 21:12:08 +0000 +++ lib/Net/Async/HTTP/Protocol.pm 2012-03-17 14:07:28 +0000 @@ -363,7 +363,8 @@ $headers->init_header( Host => $uri->authority ); } - my @headers = ( "$method $path " . $req->protocol ); + my $protocol = $req->protocol || "HTTP/1.1"; + my @headers = ( "$method $path $protocol" ); $headers->scan( sub { push @headers, "$_[0]: $_[1]" } ); $self->write( join( $CRLF, @headers ) .
This was released in 0.17 but I forgot to update the ticket. -- Paul Evans