ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-HTTP/HTTP.pm
(Generate patch)

Comparing AnyEvent-HTTP/HTTP.pm (file contents):
Revision 1.43 by root, Mon Jul 6 03:03:12 2009 UTC vs.
Revision 1.44 by root, Tue Jul 7 00:15:32 2009 UTC

41use strict; 41use strict;
42no warnings; 42no warnings;
43 43
44use Errno (); 44use Errno ();
45 45
46use AnyEvent 4.452 (); 46use AnyEvent 4.8 ();
47use AnyEvent::Util (); 47use AnyEvent::Util ();
48use AnyEvent::Socket (); 48use AnyEvent::Socket ();
49use AnyEvent::Handle (); 49use AnyEvent::Handle ();
50 50
51use base Exporter::; 51use base Exporter::;
52 52
53our $VERSION = '1.12'; 53our $VERSION = '1.4';
54 54
55our @EXPORT = qw(http_get http_post http_head http_request); 55our @EXPORT = qw(http_get http_post http_head http_request);
56 56
57our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; 57our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)";
58our $MAX_RECURSE = 10; 58our $MAX_RECURSE = 10;
419 419
420 return unless $state{connect_guard}; 420 return unless $state{connect_guard};
421 421
422 $state{connect_guard} = AnyEvent::Socket::tcp_connect $rhost, $rport, sub { 422 $state{connect_guard} = AnyEvent::Socket::tcp_connect $rhost, $rport, sub {
423 $state{fh} = shift 423 $state{fh} = shift
424 or do {
425 my $err = "$!";
426 %state = ();
424 or return (%state = (), $cb->(undef, { Status => 599, Reason => "$!", URL => $url })); 427 return $cb->(undef, { Status => 599, Reason => $err, URL => $url });
428 };
429
425 pop; # free memory, save a tree 430 pop; # free memory, save a tree
426 431
427 return unless delete $state{connect_guard}; 432 return unless delete $state{connect_guard};
428 433
429 # get handle 434 # get handle

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines