eval 'use Net::INET6Glue::INET_is_INET6';
-our $version = 20160104;
+our $version = 20160328;
our $DEBUG = $ENV{DEBUG};
my %SSL = (SSL_version => 'TLSv1');
}
request("POST /sex?BS=$bs&user=$user$mode$type$timeout$stream HTTP/1.0");
-print STDERR "==> (streaming ...)\n" if $opt_v;
+print STDERR "--> (streaming ...)\n" if $opt_v;
transfer(STDIN,$SH);
sub request {
my $req = shift;
- print STDERR "==> $req\n" if $opt_v;
- syswrite $SH,"$req\r\n\r\n";
+ print STDERR "--> $req\n" if $opt_v;
+ syswrite $SH,"$req\r\n";
+ syswrite $SH,"User-Agent: sexsend\r\n";
+ syswrite $SH,"\r\n";
for (;;) {
unless (defined($_ = &getline)) {
die "$0: server has closed the connection\n";
}
if (/^HTTP\/[\d\.]+ 200/) {
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
last;
} elsif (/^HTTP\/[\d\.]+ 199/) {
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
} else {
if ($opt_v) {
- print STDERR "<== $_";
+ print STDERR "<-- $_";
exit 3;
} else {
s:^HTTP/[ \d\.]+::;
while (defined($_ = &getline)) {
last if /^\s*$/;
$H{uc($1)} = $2 if /(.+):\s*(.+)/;
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
}
}
local $_;
$req = "GET SID HTTP/1.1";
- print STDERR "==> $req\n" if $opt_v;
+ print STDERR "--> $req\n" if $opt_v;
syswrite $SH,"$req\r\n\r\n";
$_ = &getline;
unless (defined $_ and /\w/) {
}
s/\r//;
if (/^HTTP.* 201 (.+)/) {
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
$id = 'MD5H:'.md5_hex($id.$1);
while (defined($_ = &getline)) {
s/\r//;
last if /^\n/;
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
}
} else {
die "$0: $server does not support session ID\n";