puma 4.2.1 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.md +16 -1
- data/README.md +5 -25
- data/docs/tcp_mode.md +96 -0
- data/ext/puma_http11/extconf.rb +5 -0
- data/ext/puma_http11/http11_parser.java.rl +21 -37
- data/ext/puma_http11/org/jruby/puma/Http11.java +106 -114
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +91 -106
- data/ext/puma_http11/puma_http11.c +2 -0
- data/lib/puma/binder.rb +2 -58
- data/lib/puma/cli.rb +1 -1
- data/lib/puma/const.rb +2 -2
- data/lib/puma/control_cli.rb +11 -3
- data/lib/puma/dsl.rb +4 -2
- data/lib/puma/minissl/context_builder.rb +76 -0
- data/lib/puma/reactor.rb +2 -1
- data/lib/puma/runner.rb +7 -0
- data/lib/puma/thread_pool.rb +1 -1
- metadata +4 -3
- data/lib/puma/convenient.rb +0 -25
data/lib/puma/cli.rb
CHANGED
@@ -162,7 +162,7 @@ module Puma
|
|
162
162
|
end
|
163
163
|
|
164
164
|
o.on "--extra-runtime-dependencies GEM1,GEM2", "Defines any extra needed gems when using --prune-bundler" do |arg|
|
165
|
-
|
165
|
+
user_config.extra_runtime_dependencies arg.split(',')
|
166
166
|
end
|
167
167
|
|
168
168
|
o.on "-q", "--quiet", "Do not log requests internally (default true)" do
|
data/lib/puma/const.rb
CHANGED
@@ -100,8 +100,8 @@ module Puma
|
|
100
100
|
# too taxing on performance.
|
101
101
|
module Const
|
102
102
|
|
103
|
-
PUMA_VERSION = VERSION = "4.
|
104
|
-
CODE_NAME = "
|
103
|
+
PUMA_VERSION = VERSION = "4.3.0".freeze
|
104
|
+
CODE_NAME = "Mysterious Traveller".freeze
|
105
105
|
PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
|
106
106
|
|
107
107
|
FAST_TRACK_KA_TIMEOUT = 0.2
|
data/lib/puma/control_cli.rb
CHANGED
@@ -22,7 +22,7 @@ module Puma
|
|
22
22
|
@control_auth_token = nil
|
23
23
|
@config_file = nil
|
24
24
|
@command = nil
|
25
|
-
@environment = ENV['RACK_ENV']
|
25
|
+
@environment = ENV['RACK_ENV']
|
26
26
|
|
27
27
|
@argv = argv.dup
|
28
28
|
@stdout = stdout
|
@@ -82,8 +82,10 @@ module Puma
|
|
82
82
|
@command = argv.shift
|
83
83
|
|
84
84
|
unless @config_file == '-'
|
85
|
+
environment = @environment || 'development'
|
86
|
+
|
85
87
|
if @config_file.nil?
|
86
|
-
@config_file = %W(config/puma/#{
|
88
|
+
@config_file = %W(config/puma/#{environment}.rb config/puma.rb).find do |f|
|
87
89
|
File.exist?(f)
|
88
90
|
end
|
89
91
|
end
|
@@ -130,7 +132,7 @@ module Puma
|
|
130
132
|
@pid = sf.pid
|
131
133
|
elsif @pidfile
|
132
134
|
# get pid from pid_file
|
133
|
-
|
135
|
+
File.open(@pidfile) { |f| @pid = f.read.to_i }
|
134
136
|
end
|
135
137
|
end
|
136
138
|
|
@@ -139,6 +141,12 @@ module Puma
|
|
139
141
|
|
140
142
|
# create server object by scheme
|
141
143
|
server = case uri.scheme
|
144
|
+
when "ssl"
|
145
|
+
require 'openssl'
|
146
|
+
OpenSSL::SSL::SSLSocket.new(
|
147
|
+
TCPSocket.new(uri.host, uri.port),
|
148
|
+
OpenSSL::SSL::SSLContext.new
|
149
|
+
).tap(&:connect)
|
142
150
|
when "tcp"
|
143
151
|
TCPSocket.new uri.host, uri.port
|
144
152
|
when "unix"
|
data/lib/puma/dsl.rb
CHANGED
@@ -583,6 +583,8 @@ module Puma
|
|
583
583
|
# new Bundler context and thus can float around as the release
|
584
584
|
# dictates.
|
585
585
|
#
|
586
|
+
# See also: extra_runtime_dependencies
|
587
|
+
#
|
586
588
|
# @note This is incompatible with +preload_app!+.
|
587
589
|
# @note This is only supported for RubyGems 2.2+
|
588
590
|
def prune_bundler(answer=true)
|
@@ -603,7 +605,7 @@ module Puma
|
|
603
605
|
end
|
604
606
|
|
605
607
|
# When using prune_bundler, if extra runtime dependencies need to be loaded to
|
606
|
-
# initialize your app, then this setting can be used.
|
608
|
+
# initialize your app, then this setting can be used. This includes any Puma plugins.
|
607
609
|
#
|
608
610
|
# Before bundler is pruned, the gem names supplied will be looked up in the bundler
|
609
611
|
# context and then loaded again after bundler is pruned.
|
@@ -612,7 +614,7 @@ module Puma
|
|
612
614
|
# @example
|
613
615
|
# extra_runtime_dependencies ['gem_name_1', 'gem_name_2']
|
614
616
|
# @example
|
615
|
-
# extra_runtime_dependencies ['puma_worker_killer']
|
617
|
+
# extra_runtime_dependencies ['puma_worker_killer', 'puma-heroku']
|
616
618
|
def extra_runtime_dependencies(answer = [])
|
617
619
|
@options[:extra_runtime_dependencies] = Array(answer)
|
618
620
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Puma
|
2
|
+
module MiniSSL
|
3
|
+
class ContextBuilder
|
4
|
+
def initialize(params, events)
|
5
|
+
require 'puma/minissl'
|
6
|
+
MiniSSL.check
|
7
|
+
|
8
|
+
@params = params
|
9
|
+
@events = events
|
10
|
+
end
|
11
|
+
|
12
|
+
def context
|
13
|
+
ctx = MiniSSL::Context.new
|
14
|
+
|
15
|
+
if defined?(JRUBY_VERSION)
|
16
|
+
unless params['keystore']
|
17
|
+
events.error "Please specify the Java keystore via 'keystore='"
|
18
|
+
end
|
19
|
+
|
20
|
+
ctx.keystore = params['keystore']
|
21
|
+
|
22
|
+
unless params['keystore-pass']
|
23
|
+
events.error "Please specify the Java keystore password via 'keystore-pass='"
|
24
|
+
end
|
25
|
+
|
26
|
+
ctx.keystore_pass = params['keystore-pass']
|
27
|
+
ctx.ssl_cipher_list = params['ssl_cipher_list'] if params['ssl_cipher_list']
|
28
|
+
else
|
29
|
+
unless params['key']
|
30
|
+
events.error "Please specify the SSL key via 'key='"
|
31
|
+
end
|
32
|
+
|
33
|
+
ctx.key = params['key']
|
34
|
+
|
35
|
+
unless params['cert']
|
36
|
+
events.error "Please specify the SSL cert via 'cert='"
|
37
|
+
end
|
38
|
+
|
39
|
+
ctx.cert = params['cert']
|
40
|
+
|
41
|
+
if ['peer', 'force_peer'].include?(params['verify_mode'])
|
42
|
+
unless params['ca']
|
43
|
+
events.error "Please specify the SSL ca via 'ca='"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
ctx.ca = params['ca'] if params['ca']
|
48
|
+
ctx.ssl_cipher_filter = params['ssl_cipher_filter'] if params['ssl_cipher_filter']
|
49
|
+
end
|
50
|
+
|
51
|
+
ctx.no_tlsv1 = true if params['no_tlsv1'] == 'true'
|
52
|
+
ctx.no_tlsv1_1 = true if params['no_tlsv1_1'] == 'true'
|
53
|
+
|
54
|
+
if params['verify_mode']
|
55
|
+
ctx.verify_mode = case params['verify_mode']
|
56
|
+
when "peer"
|
57
|
+
MiniSSL::VERIFY_PEER
|
58
|
+
when "force_peer"
|
59
|
+
MiniSSL::VERIFY_PEER | MiniSSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
60
|
+
when "none"
|
61
|
+
MiniSSL::VERIFY_NONE
|
62
|
+
else
|
63
|
+
events.error "Please specify a valid verify_mode="
|
64
|
+
MiniSSL::VERIFY_NONE
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
ctx
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
attr_reader :params, :events
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/puma/reactor.rb
CHANGED
data/lib/puma/runner.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'puma/server'
|
4
4
|
require 'puma/const'
|
5
|
+
require 'puma/minissl/context_builder'
|
5
6
|
|
6
7
|
module Puma
|
7
8
|
# Generic class that is used by `Puma::Cluster` and `Puma::Single` to
|
@@ -64,6 +65,12 @@ module Puma
|
|
64
65
|
control.max_threads = 1
|
65
66
|
|
66
67
|
case uri.scheme
|
68
|
+
when "ssl"
|
69
|
+
log "* Starting control server on #{str}"
|
70
|
+
params = Util.parse_query uri.query
|
71
|
+
ctx = MiniSSL::ContextBuilder.new(params, @events).context
|
72
|
+
|
73
|
+
control.add_ssl_listener uri.host, uri.port, ctx
|
67
74
|
when "tcp"
|
68
75
|
log "* Starting control server on #{str}"
|
69
76
|
control.add_tcp_listener uri.host, uri.port
|
data/lib/puma/thread_pool.rb
CHANGED
@@ -189,7 +189,7 @@ module Puma
|
|
189
189
|
# request, it might not be added to the `@todo` array right away.
|
190
190
|
# For example if a slow client has only sent a header, but not a body
|
191
191
|
# then the `@todo` array would stay the same size as the reactor works
|
192
|
-
# to try to buffer the request. In
|
192
|
+
# to try to buffer the request. In that scenario the next call to this
|
193
193
|
# method would not block and another request would be added into the reactor
|
194
194
|
# by the server. This would continue until a fully bufferend request
|
195
195
|
# makes it through the reactor and can then be processed by the thread pool.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nio4r
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- docs/restart.md
|
54
54
|
- docs/signals.md
|
55
55
|
- docs/systemd.md
|
56
|
+
- docs/tcp_mode.md
|
56
57
|
- ext/puma_http11/PumaHttp11Service.java
|
57
58
|
- ext/puma_http11/ext_help.h
|
58
59
|
- ext/puma_http11/extconf.rb
|
@@ -79,7 +80,6 @@ files:
|
|
79
80
|
- lib/puma/configuration.rb
|
80
81
|
- lib/puma/const.rb
|
81
82
|
- lib/puma/control_cli.rb
|
82
|
-
- lib/puma/convenient.rb
|
83
83
|
- lib/puma/detect.rb
|
84
84
|
- lib/puma/dsl.rb
|
85
85
|
- lib/puma/events.rb
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/puma/jruby_restart.rb
|
88
88
|
- lib/puma/launcher.rb
|
89
89
|
- lib/puma/minissl.rb
|
90
|
+
- lib/puma/minissl/context_builder.rb
|
90
91
|
- lib/puma/null_io.rb
|
91
92
|
- lib/puma/plugin.rb
|
92
93
|
- lib/puma/plugin/tmp_restart.rb
|
data/lib/puma/convenient.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'puma/launcher'
|
4
|
-
require 'puma/configuration'
|
5
|
-
|
6
|
-
module Puma
|
7
|
-
def self.run(opts={})
|
8
|
-
cfg = Puma::Configuration.new do |user_config|
|
9
|
-
if port = opts[:port]
|
10
|
-
user_config.port port
|
11
|
-
end
|
12
|
-
|
13
|
-
user_config.quiet
|
14
|
-
|
15
|
-
yield c
|
16
|
-
end
|
17
|
-
|
18
|
-
cfg.clamp
|
19
|
-
|
20
|
-
events = Puma::Events.null
|
21
|
-
|
22
|
-
launcher = Puma::Launcher.new cfg, :events => events
|
23
|
-
launcher.run
|
24
|
-
end
|
25
|
-
end
|