X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/c65ee6f7429eff9a7f58aad7c0aec858ad473092..20160919:/bin/sexsend diff --git a/bin/sexsend b/bin/sexsend index d9fe821..8b9e1d1 100755 --- a/bin/sexsend +++ b/bin/sexsend @@ -19,7 +19,7 @@ use constant M => 2**20; eval 'use Net::INET6Glue::INET_is_INET6'; -our $version = 20160104; +our $version = 20160919; our $DEBUG = $ENV{DEBUG}; my %SSL = (SSL_version => 'TLSv1'); @@ -331,7 +331,7 @@ if ($mode eq 'anonymous') { } 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); @@ -395,20 +395,22 @@ sub transfer { 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\.]+::; @@ -420,7 +422,7 @@ sub request { while (defined($_ = &getline)) { last if /^\s*$/; $H{uc($1)} = $2 if /(.+):\s*(.+)/; - print STDERR "<== $_" if $opt_v; + print STDERR "<-- $_" if $opt_v; } } @@ -461,7 +463,7 @@ sub query_sid { 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/) { @@ -470,12 +472,12 @@ sub query_sid { } 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";