about summary refs log tree commit homepage
path: root/lib/PublicInbox/HTTPD.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/HTTPD.pm')
-rw-r--r--lib/PublicInbox/HTTPD.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/HTTPD.pm b/lib/PublicInbox/HTTPD.pm
index fb683f74..02f424c6 100644
--- a/lib/PublicInbox/HTTPD.pm
+++ b/lib/PublicInbox/HTTPD.pm
@@ -13,7 +13,7 @@ use PublicInbox::Daemon;
 sub pi_httpd_async { PublicInbox::HTTPD::Async->new(@_) }
 
 sub new {
-        my ($class, $sock, $app) = @_;
+        my ($class, $sock, $app, $client) = @_;
         my $n = getsockname($sock) or die "not a socket: $sock $!\n";
         my ($host, $port) = PublicInbox::Daemon::host_with_port($n);
 
@@ -23,7 +23,8 @@ sub new {
                 SCRIPT_NAME => '',
                 'psgi.version' => [ 1, 1 ],
                 'psgi.errors' => \*STDERR,
-                'psgi.url_scheme' => 'http',
+                'psgi.url_scheme' => $client->can('accept_SSL') ?
+                                        'https' : 'http',
                 'psgi.nonblocking' => Plack::Util::TRUE,
                 'psgi.streaming' => Plack::Util::TRUE,
                 'psgi.run_once'         => Plack::Util::FALSE,