From: Eric Wong Date: Thu, 5 Jun 2025 06:53:36 +0000 (+0000) Subject: http: don't ->close after ->accept_SSL failure X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cbef2a7c791975ad3f4e678af2716ef48f20aa2;p=thirdparty%2Fpublic-inbox.git http: don't ->close after ->accept_SSL failure ->accept_SSL failures leaves the socket ref as a GLOB (not IO::Handle) and unable to respond to the ->close method. Calling close in any form isn't actually necessary at all, so just let refcounting destroy the socket. Followup-to: e85d3280 (ds: don't try ->close after ->accept_SSL failure, 2023-11-02) --- diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index f40d78385..f456f3c07 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -75,13 +75,10 @@ sub new ($$$) { my ($class, $sock, $addr, $srv_env) = @_; my $self = bless { srv_env => $srv_env }, $class; my $ev = EPOLLIN; - my $wbuf; if ($sock->can('accept_SSL') && !$sock->accept_SSL) { - return $sock->close if $! != EAGAIN; - $ev = PublicInbox::TLS::epollbit() or return $sock->close; - $wbuf = [ \&PublicInbox::DS::accept_tls_step ]; + return if $! != EAGAIN || !($ev = PublicInbox::TLS::epollbit()); + $self->{wbuf} = [ \&PublicInbox::DS::accept_tls_step ]; } - $self->{wbuf} = $wbuf if $wbuf; ($addr, $self->{remote_port}) = PublicInbox::Daemon::host_with_port($addr); $self->{remote_addr} = $addr if $addr ne '127.0.0.1';