X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=script%2Fpublic-inbox-httpd;h=a4dd809916c5116db301ec30c65f0919a48517ec;hb=7e4bd71efcf3bf61216ec1a7577e33be5f95b8a9;hp=3befdab800fbea9bc385cc2fbf2277eff22f0a11;hpb=d78f50649a5545d66a61b5465ca7f5ce4be398ea;p=public-inbox.git diff --git a/script/public-inbox-httpd b/script/public-inbox-httpd index 3befdab8..a4dd8099 100755 --- a/script/public-inbox-httpd +++ b/script/public-inbox-httpd @@ -1,9 +1,10 @@ #!/usr/bin/perl -w -# Copyright (C) 2016-2020 all contributors +# Copyright (C) 2016-2021 all contributors # License: AGPL-3.0+ # # Standalone HTTP server for public-inbox. use strict; +use v5.10.1; use PublicInbox::Daemon; BEGIN { for (qw(Plack::Builder Plack::Util)) { @@ -14,7 +15,7 @@ BEGIN { require PublicInbox::HTTPD; } -my %httpds; +my %httpds; # per-listen-FD mapping for HTTPD->{env}->{SERVER_} my $app; my $refresh = sub { if (@ARGV) { @@ -37,12 +38,14 @@ my $refresh = sub { sub { $www->call(@_) }; }; } + %httpds = (); # invalidate cache }; PublicInbox::Daemon::run('0.0.0.0:8080', $refresh, - sub ($$$) { # post_accept - my ($client, $addr, $srv) = @_; + sub ($$$) { # Listener->{post_accept} + my ($client, $addr, $srv, $tls_wrap) = @_; my $fd = fileno($srv); - my $h = $httpds{$fd} ||= PublicInbox::HTTPD->new($srv, $app); + my $h = $httpds{$fd} //= + PublicInbox::HTTPD->new($srv, $app, $client); PublicInbox::HTTP->new($client, $addr, $h), });