about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-02-12 04:00:38 +0000
committerEric Wong <e@80x24.org>2016-02-12 04:03:28 +0000
commita4400935d2db7028420a216f735d4d4029f985d4 (patch)
treeb0f63b0b950ee5e45379577154bf6081dbfaa4fd /lib
parentf79a43a96dbda5e4e6692778bb3f10ee8874c7c8 (diff)
downloadyahns-a4400935d2db7028420a216f735d4d4029f985d4.tar.gz
env['HTTPS'] is not documented in rack SPEC, but appears to be
used by Rack::Request since 2010[*].  Also, set rack.url_scheme
as documented by rack SPEC.

[*] - commit 4defbe5d7c07b3ba721ff34a8ff59fde480a4a9f
      ("Improves performance by lazy loading the session.")
Diffstat (limited to 'lib')
-rw-r--r--lib/yahns/http_context.rb2
-rw-r--r--lib/yahns/server.rb3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/yahns/http_context.rb b/lib/yahns/http_context.rb
index 10be062..c02eefd 100644
--- a/lib/yahns/http_context.rb
+++ b/lib/yahns/http_context.rb
@@ -17,7 +17,7 @@ module Yahns::HttpContext # :nodoc:
   attr_accessor :qegg
   attr_accessor :queue # set right before spawning acceptors
   attr_reader :app
-  attr_reader :app_defaults
+  attr_accessor :app_defaults
   attr_writer :input_buffer_tmpdir
   attr_accessor :output_buffer_tmpdir
 
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb
index 09ddbef..d6a03f3 100644
--- a/lib/yahns/server.rb
+++ b/lib/yahns/server.rb
@@ -382,6 +382,9 @@ class Yahns::Server # :nodoc:
       ctx.__send__(:include, l.expire_mod)
       if ssl_ctx = opts[:ssl_ctx]
         ctx.__send__(:include, Yahns::OpenSSLClient)
+        env = ctx.app_defaults = ctx.app_defaults.dup
+        env['HTTPS'] = 'on' # undocumented, but Rack::Request uses this
+        env['rack.url_scheme'] = 'https'
 
         # call OpenSSL::SSL::SSLContext#setup explicitly here to detect
         # errors and avoid race conditions.  We avoid calling this in the