+ } elsif ($state eq 'waitlocation') {
+ my ($path) = $msg =~ m|Location:\s*(.*)|;
+ if ($path) {
+ my @uri = split m|/+|, $path;
+ if ($uri[0] eq 'http:') {
+ shift @uri;
+ my $host = shift @uri;
+ my $newpath = '/' . join('/', @uri);
+ $newpath .= '/' if $path =~ m|/$|;
+ _getpost(ref $conn, $conn->{asyncsort}, $conn->{caller}, $host, 80, $newpath, @{$conn->{asyncargs}});
+ } elsif ($path =~ m|^/|) {
+ _getpost(ref $conn, $conn->{asyncsort}, $conn->{caller}, $conn->{peerhost}, $conn->{peerport}, $path,
+ @{$conn->{asyncargs}});
+ }
+ delete $conn->{on_disconnect};
+ $conn->disconnect;
+ }