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.124 by root, Fri May 8 21:26:16 2015 UTC vs.
Revision 1.126 by root, Thu Jan 7 13:14:16 2016 UTC

46use AnyEvent::Util (); 46use AnyEvent::Util ();
47use AnyEvent::Handle (); 47use AnyEvent::Handle ();
48 48
49use base Exporter::; 49use base Exporter::;
50 50
51our $VERSION = 2.21; 51our $VERSION = 2.22;
52 52
53our @EXPORT = qw(http_get http_post http_head http_request); 53our @EXPORT = qw(http_get http_post http_head http_request);
54 54
55our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; 55our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)";
56our $MAX_RECURSE = 10; 56our $MAX_RECURSE = 10;
895 # we give our best and fall back to URI if available. 895 # we give our best and fall back to URI if available.
896 if (exists $hdr{location}) { 896 if (exists $hdr{location}) {
897 my $loc = $hdr{location}; 897 my $loc = $hdr{location};
898 898
899 if ($loc =~ m%^//%) { # // 899 if ($loc =~ m%^//%) { # //
900 $loc = "$rscheme:$loc"; 900 $loc = "$uscheme:$loc";
901 901
902 } elsif ($loc eq "") { 902 } elsif ($loc eq "") {
903 $loc = $url; 903 $loc = $url;
904 904
905 } elsif ($loc !~ /^(?: $ | [^:\/?\#]+ : )/x) { # anything "simple" 905 } elsif ($loc !~ /^(?: $ | [^:\/?\#]+ : )/x) { # anything "simple"
906 $loc =~ s/^\.\/+//; 906 $loc =~ s/^\.\/+//;
907 907
908 if ($loc !~ m%^[.?#]%) { 908 if ($loc !~ m%^[.?#]%) {
909 my $prefix = "$rscheme://$uhost:$uport"; 909 my $prefix = "$uscheme://$uhost:$uport";
910 910
911 unless ($loc =~ s/^\///) { 911 unless ($loc =~ s/^\///) {
912 $prefix .= $upath; 912 $prefix .= $upath;
913 $prefix =~ s/\/[^\/]*$//; 913 $prefix =~ s/\/[^\/]*$//;
914 } 914 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines