yahns 1.12.1 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fd3617f72db8e2c7a45a5b0273571b721c9cfad
4
- data.tar.gz: 144a50bd647079d46b5e78a80b659eed0b107a8d
3
+ metadata.gz: 7e7f2c5c9c51e65d39f39ecb7424434393e72673
4
+ data.tar.gz: dbbc9e3459a4f89ab0bd2ad46bd72f60001d04be
5
5
  SHA512:
6
- metadata.gz: 606ab401acd65b522b5f340103f958d68ff4ff4ca3d2f7b7d563115e0b53bf9dd27a207c2581b6bc3ec0bdfad92b3a47ff1e75bec53d8d1e1223e5023e6e0f66
7
- data.tar.gz: c1b03ad4decab3a575873e8925d207809ab9201c805525eaa97d5d2822eb9d797c47354220035d4ef01eadc3a2f2dd2c5faf7de8ce34d327b071c6f398fb47db
6
+ metadata.gz: 8840e5441afcda2aa8b20c3b0ae3a2fc935d97260f86cea8b04e29ca78d0dfcbaaac717400ca3f7249d1b97c76302b3f1a20758a4d90154b0b0b577f6dc178ae
7
+ data.tar.gz: a4d783b2ae2a860dfe948bb1d4747afb2dd8bf465bf3faf0c9a530ec5c7cde7fc38fdb0e3fb05c8782364c081ced26728d4a24a7837994738ad586d1fab76229
@@ -446,11 +446,20 @@ An example which seems to work is:
446
446
  ssl_ctx.key = OpenSSL::PKey::RSA.new(
447
447
  IO.read('/etc/ssl/private/example.key')
448
448
  )
449
+ ssl_ctx.set_params # use defaults provided by Ruby on top of OpenSSL
449
450
 
450
451
  app(:rack, "/path/to/my/app/config.ru") do
451
452
  listen 443, ssl_ctx: ssl_ctx
452
453
  end
453
454
 
455
+ yahns gives you full control of of how OpenSSL::SSL::SSLContext is
456
+ configured. To avoid bugs, yahns only ensures
457
+ OpenSSL::SSL::SSLContext#session_id_context is set (if not previously
458
+ set by the user) and calls OpenSSL::SSL::SSLContext#setup before
459
+ spawning threads to avoid race conditions. yahns itself does not and
460
+ will not enforce any opinion on the compatibility/performance/security
461
+ trade-offs regarding TLS configuration.
462
+
454
463
  =item umask: MODE
455
464
 
456
465
  Sets the file mode creation mask for UNIX sockets. If specified,
@@ -5,7 +5,7 @@
5
5
  CONSTANT = "Yahns::VERSION"
6
6
  RVF = "lib/yahns/version.rb"
7
7
  GVF = "GIT-VERSION-FILE"
8
- DEF_VER = "v1.12.1"
8
+ DEF_VER = "v1.12.2"
9
9
  vn = DEF_VER.dup
10
10
 
11
11
  # First see if there is a version file (included in release tarballs),
@@ -386,6 +386,13 @@ def fdmap_init
386
386
  env['HTTPS'] = 'on' # undocumented, but Rack::Request uses this
387
387
  env['rack.url_scheme'] = 'https'
388
388
 
389
+ # avoid "session id context uninitialized" errors when a client
390
+ # attempts to reuse a cached SSL session. Server admins may
391
+ # configure their own cache and session_id_context if desired.
392
+ # 32 bytes is SSL_MAX_SSL_SESSION_ID_LENGTH and has been since
393
+ # the SSLeay days
394
+ ssl_ctx.session_id_context ||= OpenSSL::Random.random_bytes(32)
395
+
389
396
  # call OpenSSL::SSL::SSLContext#setup explicitly here to detect
390
397
  # errors and avoid race conditions. We avoid calling this in the
391
398
  # parent process since
@@ -88,21 +88,23 @@ def __covmerge
88
88
 
89
89
  require "tempfile"
90
90
  require 'tmpdir'
91
- class Dir
92
- def Dir.mktmpdir
93
- begin
94
- d = "#{Dir.tmpdir}/#$$.#{rand}"
95
- Dir.mkdir(d)
96
- rescue Errno::EEXIST
97
- end while true
98
- return d unless block_given?
99
- begin
100
- yield d
101
- ensure
102
- FileUtils.remove_entry(d)
103
- end
91
+
92
+ # Can't rely on mktmpdir until we drop Ruby 1.9.3 support
93
+ def yahns_mktmpdir
94
+ d = nil
95
+ begin
96
+ dir = "#{Dir.tmpdir}/yahns.#$$.#{rand}"
97
+ Dir.mkdir(dir)
98
+ d = dir
99
+ rescue Errno::EEXIST
100
+ end until d
101
+ return d unless block_given?
102
+ begin
103
+ yield d
104
+ ensure
105
+ FileUtils.remove_entry(d)
104
106
  end
105
- end unless Dir.respond_to?(:mktmpdir)
107
+ end
106
108
 
107
109
  def tmpfile(*args)
108
110
  tmp = Tempfile.new(*args)
@@ -149,7 +149,7 @@ def test_usr2_nopreload_worker; usr2(false, true); end
149
149
  def test_usr2_nopreload_noworker; usr2(false, false); end
150
150
 
151
151
  def usr2(preload, worker)
152
- Dir.mktmpdir { |tmpdir| usr2_dir(tmpdir, preload, worker) }
152
+ yahns_mktmpdir { |tmpdir| usr2_dir(tmpdir, preload, worker) }
153
153
  end
154
154
 
155
155
  def usr2_dir(tmpdir, preload, worker)
@@ -16,7 +16,7 @@ def setup
16
16
  rescue
17
17
  skip "test needs inotify"
18
18
  end
19
- @tmpdir = Dir.mktmpdir
19
+ @tmpdir = yahns_mktmpdir
20
20
  server_helper_setup
21
21
  end
22
22
 
@@ -14,7 +14,7 @@ def test_initialize
14
14
 
15
15
  def test_multi_conf_example
16
16
  pid = fork do
17
- tmpdir = Dir.mktmpdir
17
+ tmpdir = yahns_mktmpdir
18
18
 
19
19
  # modify the example config file for testing
20
20
  path = "examples/yahns_multi.conf.rb"
@@ -38,7 +38,7 @@ def test_multi_conf_example
38
38
 
39
39
  def test_rack_basic_conf_example
40
40
  pid = fork do
41
- tmpdir = Dir.mktmpdir
41
+ tmpdir = yahns_mktmpdir
42
42
 
43
43
  # modify the example config file for testing
44
44
  path = "examples/yahns_rack_basic.conf.rb"
@@ -10,7 +10,7 @@ class TestExtrasAutoindex < Testcase
10
10
  include ServerHelper
11
11
 
12
12
  def setup
13
- @tmpdir = Dir.mktmpdir
13
+ @tmpdir = yahns_mktmpdir
14
14
  server_helper_setup
15
15
  skip 'Ruby 2.x required' unless ''.respond_to?(:b)
16
16
  end
@@ -11,7 +11,7 @@ class TestExtrasTryGzipStatic < Testcase
11
11
  GPL_TEXT = IO.binread("COPYING").freeze
12
12
 
13
13
  def setup
14
- @tmpdir = Dir.mktmpdir
14
+ @tmpdir = yahns_mktmpdir
15
15
  server_helper_setup
16
16
  skip 'Ruby 2.x required' unless ''.respond_to?(:b)
17
17
  end
@@ -177,7 +177,7 @@ def teardown
177
177
  end
178
178
 
179
179
  def test_unix_socket_no_path
180
- tmpdir = Dir.mktmpdir
180
+ tmpdir = yahns_mktmpdir
181
181
  unix_path = "#{tmpdir}/proxy_pass.sock"
182
182
  unix_srv = UNIXServer.new(unix_path)
183
183
  err, cfg, host, port = @err, Yahns::Config.new, @srv.addr[3], @srv.addr[1]
@@ -10,7 +10,7 @@ class TestServeStatic < Testcase
10
10
  alias teardown server_helper_teardown
11
11
 
12
12
  def test_serve_static
13
- tmpdir = Dir.mktmpdir
13
+ tmpdir = yahns_mktmpdir
14
14
  sock = "#{tmpdir}/sock"
15
15
  err = @err
16
16
  cfg = Yahns::Config.new
@@ -120,7 +120,7 @@ def close
120
120
  end
121
121
 
122
122
  def test_aborted_sendfile_closes_opened_path
123
- tmpdir = Dir.mktmpdir
123
+ tmpdir = yahns_mktmpdir
124
124
  mksparse(tmpdir)
125
125
  fifo = "#{tmpdir}/to_path--close"
126
126
  assert system("mkfifo", fifo), "mkfifo"
@@ -147,7 +147,7 @@ def test_aborted_sendfile_closes_opened_path
147
147
  end
148
148
 
149
149
  def test_truncated_sendfile
150
- tmpdir = Dir.mktmpdir
150
+ tmpdir = yahns_mktmpdir
151
151
  size, sparse = mksparse(tmpdir)
152
152
  err, cfg, host, port = @err, Yahns::Config.new, @srv.addr[3], @srv.addr[1]
153
153
  pid = mkserver(cfg) do
@@ -169,7 +169,7 @@ def test_truncated_sendfile
169
169
  end
170
170
 
171
171
  def test_expanded_sendfile
172
- tmpdir = Dir.mktmpdir
172
+ tmpdir = yahns_mktmpdir
173
173
  size, sparse = mksparse(tmpdir)
174
174
  err, cfg, host, port = @err, Yahns::Config.new, @srv.addr[3], @srv.addr[1]
175
175
  pid = mkserver(cfg) do
@@ -179,7 +179,7 @@ def trailer(btype, delay = false)
179
179
  end
180
180
 
181
181
  def test_check_client_connection
182
- tmpdir = Dir.mktmpdir
182
+ tmpdir = yahns_mktmpdir
183
183
  sock = "#{tmpdir}/sock"
184
184
  unix_srv = UNIXServer.new(sock)
185
185
  unix_srv.close_on_exec = true
@@ -511,7 +511,7 @@ def test_mp_hooks_worker_nr
511
511
  end
512
512
 
513
513
  def test_pidfile_usr2
514
- tmpdir = Dir.mktmpdir
514
+ tmpdir = yahns_mktmpdir
515
515
  pidf = "#{tmpdir}/pid"
516
516
  old = "#{pidf}.oldbin"
517
517
  err = @err
@@ -635,7 +635,7 @@ def test_working_directory
635
635
  ru = lambda { |_|
636
636
  [ 200, {'Content-Length'=>Dir.pwd.size.to_s }, [Dir.pwd] ]
637
637
  }
638
- Dir.mktmpdir do |tmpdir|
638
+ yahns_mktmpdir do |tmpdir|
639
639
  begin
640
640
  pid = mkserver(cfg) do
641
641
  $LOAD_PATH << File.expand_path("lib")
@@ -656,7 +656,7 @@ def test_working_directory
656
656
  end
657
657
 
658
658
  def test_errors
659
- tmpdir = Dir.mktmpdir
659
+ tmpdir = yahns_mktmpdir
660
660
  sock = "#{tmpdir}/sock"
661
661
  err, cfg, host, port = @err, Yahns::Config.new, @srv.addr[3], @srv.addr[1]
662
662
  re = tmpfile(%w(rack .errors))
@@ -23,7 +23,7 @@ def unix_socket(path)
23
23
  end
24
24
 
25
25
  def test_socket
26
- tmpdir = Dir.mktmpdir
26
+ tmpdir = yahns_mktmpdir
27
27
  err, cfg = @err, Yahns::Config.new
28
28
  sock = "#{tmpdir}/sock"
29
29
  cfg.instance_eval do
@@ -48,7 +48,7 @@ def test_socket
48
48
  end
49
49
 
50
50
  def test_socket_perms
51
- tmpdir = Dir.mktmpdir
51
+ tmpdir = yahns_mktmpdir
52
52
  err, cfg = @err, Yahns::Config.new
53
53
  sock = "#{tmpdir}/sock"
54
54
  cfg.instance_eval do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahns
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.1
4
+ version: 1.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yahns hackers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kgio