diff options
author | Eric Wong <e@80x24.org> | 2022-08-01 21:24:42 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-08-02 19:20:10 +0000 |
commit | a55a38db0276a8ce1a09392573af6e1305cbaba9 (patch) | |
tree | 24cbfa60cc599b8b5b9f2067a61d497c6b2d0d9a /lib/PublicInbox/Daemon.pm | |
parent | 37939c45e9eee222dd8ec35c941271b87bd02885 (diff) | |
download | public-inbox-a55a38db0276a8ce1a09392573af6e1305cbaba9.tar.gz |
This brings the HTTP server closer to the IMAP/NNTP/POP3 implementations and eliminates package-wide globals in PublicInbox::HTTPD. The end goal is to be able to host completely different PSGI applications on different listen ports.
Diffstat (limited to 'lib/PublicInbox/Daemon.pm')
-rw-r--r-- | lib/PublicInbox/Daemon.pm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index bceae6e5..1af03cc4 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -81,11 +81,11 @@ sub load_mod ($) { my $mod = $modc.'D'; eval "require $mod"; # IMAPD|HTTPD|NNTPD|POP3D die $@ if $@; - my %xn = map { $_ => $mod->can($_) } qw(refresh post_accept); - $xn{tlsd} = $mod->new if $mod->can('refresh_groups'); #!HTTPD - my $tlsd = $xn{tlsd}; - $xn{refresh} //= sub { $tlsd->refresh_groups(@_) }; - $xn{post_accept} //= sub { $modc->new($_[0], $tlsd) }; + my %xn; + my $tlsd = $xn{tlsd} = $mod->new; + $xn{refresh} = sub { $tlsd->refresh_groups(@_) }; + $xn{post_accept} = $tlsd->can('post_accept_cb') ? + $tlsd->post_accept_cb : sub { $modc->new($_[0], $tlsd) }; $xn{af_default} = 'httpready' if $modc eq 'PublicInbox::HTTP'; \%xn; } |