AIS-client
view release on metacpan or search on metacpan
connect(SOCK, $paddr) || die "connect: $!";
# SOCK->autoflush(1);
my $ofh = select SOCK;
$| = 1;
select $ofh;
my $Query = join("\r\n", # "CRLF"
"GET $Desired HTTP/1.1",
# Do we need a Host: header with an "AbsoluteURI?"
# not needed: http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.2
# but this is trumped by an Apache error message invoking RFC2068 sections 9 and 14.23
"Host: $HostName",
"User-Agent: $agent",
"Connection: close",
'','') ;
print SOCK $Query or croak "could not print to miniget socket";
join('',<SOCK>);
ENDMINIGET
# carp "got $Response";
(my $AISXML) =
$Response =~ m#<aisresponse>(.+)</aisresponse>#si
or die "no <aisresponse> element from ${aissri}query?$OTUkey\n in BEGINRESPONSE\n$Response\nENDRESPONSE";
$Sessions{$Coo}->{AISXML} = $AISXML;
# parse AISXML...
my %aisvar;
foreach (qw{
identity
error
aissri
user_remote_addr
}
# ,@{$Param{XML}}
){
$AISXML =~ m#<$_>(.+)</$_>#si or next;
$aisvar{$_} = $1;
# print STDERR "ais var $_ is $1\n";
};
$Sessions{$Coo}->{PostData} = <>;
print "Set-Cookie:/${SessionPrefix}_session=$Coo\n";
redirect "http$ssl_ext://$ENV{SERVER_NAME}$ENV{SCRIPT_NAME}$ENV{PATH_INFO}?AIS_INITIAL$suffix";
exit;
};
print <<EOF;
Content-Type: text/plain
internal AIS module logic error
EOF
exit;
EOF
exit;
HAVE_ID:
$Sessions{$Coo}->{last_access} = time;
$Identity = $Sessions{$Coo}->{identity};
if($Identity eq 'ERROR'){
print <<EOF;
Content-type: text/plain
There was an error with the authentication layer
of this web service: $Sessions{$Coo}->{error}
please contact $ENV{SERVER_ADMIN} to report this.
EOF
exit;
};
# print STDERR "setting ",caller().'::AIS_IDENTITY', " to $Sessions{$Coo}->{identity}\n";
# $ENV{AIS_IDENTITY} = $Sessions{$Coo}->{identity};
( run in 1.353 second using v1.01-cache-2.11-cpan-49f99fa48dc )