I wrote a simplistic REST server in Perl using HTTP::Daemon, recently upgraded to HTTP::Daemon:SSL.
However I have a problem I don't understand how to handle correctly:
When connecting to my server from Edge on Windows, Edge warns about the CA being unknown, and at the same time my server quits.
The main loop looks like this:
use 5.018;
use strict;
use warnings;
use Carp;
use HTTP::Daemon::SSL;
use Errno;
#...
# listening on address '' and port 0
my $daemon = HTTP::Daemon::SSL->new(%daemon_options);
#...error checking, of course...
while (defined(my $conn = $daemon->accept) || $! == Errno::EINTR) {
# request loop
} continue {
print "accepting connections on ", $daemon->url, "\n";
}
print "accept() on ", $daemon->url, " failed: $!\n";
$daemon->close or print STDERR "close failed: $!\n";
What the program outputs on the specific error case is:
accept() on https://short-host-name:8084/ failed:
Specifically, there is no error message from $!.
What is wrong, i.e. what causes $connto be undefined?
Strace
Maybe this partial strace is helpful:
accept(3, {sa_family=AF_INET, sin_port=htons(56280), sin_addr=inet_addr("172.24.10.70")}, [4096 => 16]) = 4
ioctl(4, TCGETS, 0x7fffac9fa2e0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
ioctl(4, TCGETS, 0x7fffac9fa2e0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
setsockopt(4, SOL_TCP, TCP_ULP, [7564404], 4) = 0
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
brk(0x560c67ed3000) = 0x560c67ed3000
read(4, "\26\3\1\6\316", 5) = 5
read(4, "\1\0\6\312\3\3\21]\300\1L:\16\272\323\300\2254!\373\177\254b\267\3130\3\10\262RH/"..., 1742) = 1742
getpid() = 22345
getpid() = 22345
getpid() = 22345
getpid() = 22345
write(4, "\26\3\3\0z\2\0\0v\3\3\34\f\16\354\334\3625\307\357/_DC!\323\327\207\230\324\264\216"..., 3712) = 3712
read(4, "\24\3\3\0\1", 5) = 5
read(4, "\1", 1) = 1
read(4, "\27\3\3\0\23", 5) = 5
read(4, "\2I\277\224gwCH\220\265\373\235\276\365$\r\241\332\250", 19) = 19
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
close(4) = 0
getsockname(3, {sa_family=AF_INET, sin_port=htons(8084), sin_addr=inet_addr("0.0.0.0")}, [256 => 16]) = 0
getsockname(3, {sa_family=AF_INET, sin_port=htons(8084), sin_addr=inet_addr("0.0.0.0")}, [256 => 16]) = 0
Perl is 5.26.1, perl-HTTP-Daemon-6.01-150000.3.5.1.noarch, perl-HTTPS-Daemon-1.04-bp157.54.1.x86_64 (all SLES15b SP7 on x86_64)