… | |
… | |
48 | use AnyEvent::Socket (); |
48 | use AnyEvent::Socket (); |
49 | use AnyEvent::Handle (); |
49 | use AnyEvent::Handle (); |
50 | |
50 | |
51 | use base Exporter::; |
51 | use base Exporter::; |
52 | |
52 | |
53 | our $VERSION = '1.04'; |
53 | our $VERSION = '1.05'; |
54 | |
54 | |
55 | our @EXPORT = qw(http_get http_post http_head http_request); |
55 | our @EXPORT = qw(http_get http_post http_head http_request); |
56 | |
56 | |
57 | our $USERAGENT = "Mozilla/5.0 (compatible; AnyEvent::HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; |
57 | our $USERAGENT = "Mozilla/5.0 (compatible; AnyEvent::HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; |
58 | our $MAX_RECURSE = 10; |
58 | our $MAX_RECURSE = 10; |
… | |
… | |
398 | my %kv = (value => $value, map { split /=/, $_, 2 } @arg); |
398 | my %kv = (value => $value, map { split /=/, $_, 2 } @arg); |
399 | |
399 | |
400 | my $cdom = (delete $kv{domain}) || $uhost; |
400 | my $cdom = (delete $kv{domain}) || $uhost; |
401 | my $cpath = (delete $kv{path}) || "/"; |
401 | my $cpath = (delete $kv{path}) || "/"; |
402 | |
402 | |
403 | $cdom =~ s/^.?/./; # make sure it starts with a "." |
403 | $cdom =~ s/^\.?/./; # make sure it starts with a "." |
404 | |
404 | |
405 | next if $cdom =~ /\.$/; |
405 | next if $cdom =~ /\.$/; |
406 | |
406 | |
407 | # this is not rfc-like and not netscape-like. go figure. |
407 | # this is not rfc-like and not netscape-like. go figure. |
408 | my $ndots = $cdom =~ y/.//; |
408 | my $ndots = $cdom =~ y/.//; |