our ($FEXID,$FEXXX,$HOME);
our (%alias);
our $chunksize = 0;
-our $version = 20150615;
+our $version = 20150729;
our $_0 = $0;
our $DEBUG;
my $fexcgi; # F*EX CGI URL
my @files; # files to send
my %AB = (); # server based address book
-my ($server,$port,$sid);
+my ($server,$port,$sid,$https);
my $proxy = '';
my $proxy_prefix = '';
my $features = '';
or: $0 -x \# [-C -k -D -K -S]
options: -v verbose mode
-d delete file on fex server
- -c compress file
+ -c compress file with gzip
-g encrypt file with gpg
-m limit limit throughput (kB/s)
-i tag use ID data [tag] from ID file
$port = 443 if $server =~ s{https://}{};
$port = $1 if $server =~ s/:(\d+)//;
-if (0 and $port == 443) {
- $opt_s and die "$0: cannot use -s with https due to stunnel bug\n";
- $opt_g and die "$0: cannot use -g with https due to stunnel bug\n";
+if ($port == 443) {
+ # $opt_s and die "$0: cannot use -s with https due to stunnel bug\n";
+ # $opt_g and die "$0: cannot use -g with https due to stunnel bug\n";
+ $https = $port;
}
$server =~ s{http://}{};
}
}
}
+ unless ($opt_d or $location) {
+ if (scalar(@r) == 1) {
+ die "$0: server error: @r\n";
+ } else {
+ if ($r[0] !~ /HTTP.1.. 2/ and $r[0] =~ /HTTP.[\s\d.]+(.+)/) {
+ die "$0: server error: $1\n";
+ } else {
+ die "$0: server error:\n".join("\n",@r)."\n";
+ }
+ }
+ }
}
}
$SIG{ALRM} = sub { retry("timed out") };
while (my $b = read $file,$buf,$bs) {
alarm($timeout*2);
- syswrite $SH,$buf or &sigpipehandler;
+ if ($https) {
+ print {$SH} $buf or &sigpipehandler;
+ } else {
+ syswrite $SH,$buf or &sigpipehandler;
+ }
alarm(0);
$bytes += $b;
if ($filesize > 0 and $bytes+$seek > $filesize) {
if ($proxy) {
tcpconnect(split(':',$proxy));
- if ($port == 443) {
+ if ($https) {
printf "--> %s\n",$connect if $opt_v;
nvtsend($connect,"");
$_ = <$SH>;
} else {
tcpconnect($server,$port);
}
-# if ($port == 443 and $opt_v) {
+# if ($https and $opt_v) {
# printf "%s\n",$SH->get_cipher();
# }
}
undef $SH;
}
- if ($port == 443) {
+ if ($https) {
# eval "use IO::Socket::SSL qw(debug3)";
&enable_ssl;
$SH = IO::Socket::SSL->new(