puma 5.5.2-java → 5.6.0-java
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.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.md +51 -0
- data/LICENSE +0 -0
- data/README.md +5 -0
- data/bin/puma-wild +0 -0
- data/docs/architecture.md +4 -4
- data/docs/compile_options.md +0 -0
- data/docs/deployment.md +0 -0
- data/docs/fork_worker.md +0 -0
- data/docs/images/puma-connection-flow-no-reactor.png +0 -0
- data/docs/images/puma-connection-flow.png +0 -0
- data/docs/images/puma-general-arch.png +0 -0
- data/docs/jungle/README.md +0 -0
- data/docs/jungle/rc.d/README.md +0 -0
- data/docs/jungle/rc.d/puma.conf +0 -0
- data/docs/kubernetes.md +0 -0
- data/docs/nginx.md +0 -0
- data/docs/plugins.md +0 -0
- data/docs/rails_dev_mode.md +0 -0
- data/docs/restart.md +0 -0
- data/docs/signals.md +1 -0
- data/docs/stats.md +0 -0
- data/docs/systemd.md +0 -0
- data/ext/puma_http11/PumaHttp11Service.java +0 -0
- data/ext/puma_http11/ext_help.h +0 -0
- data/ext/puma_http11/extconf.rb +12 -6
- data/ext/puma_http11/http11_parser.c +0 -0
- data/ext/puma_http11/http11_parser.h +0 -0
- data/ext/puma_http11/http11_parser.java.rl +0 -0
- data/ext/puma_http11/http11_parser.rl +0 -0
- data/ext/puma_http11/http11_parser_common.rl +0 -0
- data/ext/puma_http11/mini_ssl.c +54 -9
- data/ext/puma_http11/no_ssl/PumaHttp11Service.java +0 -0
- data/ext/puma_http11/org/jruby/puma/Http11.java +0 -0
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +0 -0
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +28 -43
- data/ext/puma_http11/puma_http11.c +1 -1
- data/lib/puma/app/status.rb +0 -0
- data/lib/puma/binder.rb +19 -5
- data/lib/puma/cli.rb +9 -4
- data/lib/puma/client.rb +1 -1
- data/lib/puma/cluster/worker.rb +5 -5
- data/lib/puma/cluster/worker_handle.rb +4 -0
- data/lib/puma/cluster.rb +29 -11
- data/lib/puma/commonlogger.rb +0 -0
- data/lib/puma/configuration.rb +3 -0
- data/lib/puma/const.rb +2 -5
- data/lib/puma/control_cli.rb +0 -0
- data/lib/puma/detect.rb +8 -2
- data/lib/puma/dsl.rb +85 -8
- data/lib/puma/error_logger.rb +0 -0
- data/lib/puma/events.rb +0 -0
- data/lib/puma/io_buffer.rb +0 -0
- data/lib/puma/jruby_restart.rb +0 -0
- data/lib/puma/json_serialization.rb +0 -0
- data/lib/puma/launcher.rb +2 -1
- data/lib/puma/minissl/context_builder.rb +8 -6
- data/lib/puma/minissl.rb +18 -2
- data/lib/puma/null_io.rb +0 -0
- data/lib/puma/plugin/tmp_restart.rb +0 -0
- data/lib/puma/plugin.rb +1 -1
- data/lib/puma/puma_http11.jar +0 -0
- data/lib/puma/queue_close.rb +0 -0
- data/lib/puma/rack/builder.rb +0 -0
- data/lib/puma/rack/urlmap.rb +0 -0
- data/lib/puma/rack_default.rb +0 -0
- data/lib/puma/reactor.rb +0 -0
- data/lib/puma/request.rb +47 -29
- data/lib/puma/runner.rb +3 -2
- data/lib/puma/server.rb +29 -33
- data/lib/puma/single.rb +0 -0
- data/lib/puma/state_file.rb +41 -7
- data/lib/puma/systemd.rb +0 -0
- data/lib/puma/thread_pool.rb +2 -2
- data/lib/puma/util.rb +0 -0
- data/lib/puma.rb +0 -0
- data/lib/rack/handler/puma.rb +0 -0
- data/tools/Dockerfile +1 -1
- data/tools/trickletest.rb +0 -0
- metadata +3 -3
data/lib/puma/server.rb
CHANGED
@@ -220,7 +220,7 @@ module Puma
|
|
220
220
|
# up in the background to handle requests. Otherwise requests
|
221
221
|
# are handled synchronously.
|
222
222
|
#
|
223
|
-
def run(background=true, thread_name: '
|
223
|
+
def run(background=true, thread_name: 'srv')
|
224
224
|
BasicSocket.do_not_reverse_lookup = true
|
225
225
|
|
226
226
|
@events.fire :state, :booting
|
@@ -315,16 +315,15 @@ module Puma
|
|
315
315
|
queue_requests = @queue_requests
|
316
316
|
drain = @options[:drain_on_shutdown] ? 0 : nil
|
317
317
|
|
318
|
-
|
319
|
-
remote_addr_header = nil
|
320
|
-
|
321
|
-
case @options[:remote_address]
|
318
|
+
addr_send_name, addr_value = case @options[:remote_address]
|
322
319
|
when :value
|
323
|
-
|
320
|
+
[:peerip=, @options[:remote_address_value]]
|
324
321
|
when :header
|
325
|
-
remote_addr_header
|
322
|
+
[:remote_addr_header=, @options[:remote_address_header]]
|
326
323
|
when :proxy_protocol
|
327
|
-
|
324
|
+
[:expect_proxy_proto=, @options[:remote_address_proxy_protocol]]
|
325
|
+
else
|
326
|
+
[nil, nil]
|
328
327
|
end
|
329
328
|
|
330
329
|
while @status == :run || (drain && shutting_down?)
|
@@ -344,16 +343,10 @@ module Puma
|
|
344
343
|
next
|
345
344
|
end
|
346
345
|
drain += 1 if shutting_down?
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
elsif remote_addr_header
|
352
|
-
client.remote_addr_header = remote_addr_header
|
353
|
-
elsif remote_addr_proxy_protocol
|
354
|
-
client.expect_proxy_proto = remote_addr_proxy_protocol
|
355
|
-
end
|
356
|
-
pool << client
|
346
|
+
pool << Client.new(io, @binder.env(sock)).tap { |c|
|
347
|
+
c.listener = sock
|
348
|
+
c.send(addr_send_name, addr_value) if addr_value
|
349
|
+
}
|
357
350
|
end
|
358
351
|
end
|
359
352
|
rescue IOError, Errno::EBADF
|
@@ -375,13 +368,14 @@ module Puma
|
|
375
368
|
rescue Exception => e
|
376
369
|
@events.unknown_error e, nil, "Exception handling servers"
|
377
370
|
ensure
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
371
|
+
# RuntimeError is Ruby 2.2 issue, can't modify frozen IOError
|
372
|
+
# Errno::EBADF is infrequently raised
|
373
|
+
[@check, @notify].each do |io|
|
374
|
+
begin
|
375
|
+
io.close unless io.closed?
|
376
|
+
rescue Errno::EBADF, RuntimeError
|
377
|
+
end
|
383
378
|
end
|
384
|
-
@notify.close
|
385
379
|
@notify = nil
|
386
380
|
@check = nil
|
387
381
|
end
|
@@ -482,7 +476,7 @@ module Puma
|
|
482
476
|
end
|
483
477
|
true
|
484
478
|
rescue StandardError => e
|
485
|
-
client_error(e, client)
|
479
|
+
client_error(e, client, buffer, requests)
|
486
480
|
# The ensure tries to close +client+ down
|
487
481
|
requests > 0
|
488
482
|
ensure
|
@@ -510,34 +504,36 @@ module Puma
|
|
510
504
|
# :nocov:
|
511
505
|
|
512
506
|
# Handle various error types thrown by Client I/O operations.
|
513
|
-
def client_error(e, client)
|
507
|
+
def client_error(e, client, buffer = ::Puma::IOBuffer.new, requests = 1)
|
514
508
|
# Swallow, do not log
|
515
509
|
return if [ConnectionError, EOFError].include?(e.class)
|
516
510
|
|
517
|
-
lowlevel_error(e, client.env)
|
518
511
|
case e
|
519
512
|
when MiniSSL::SSLError
|
520
513
|
@events.ssl_error e, client.io
|
521
514
|
when HttpParserError
|
522
|
-
client.
|
515
|
+
status, headers, res_body = lowlevel_error(e, client.env, 400)
|
516
|
+
write_response(status, headers, res_body, buffer, requests, client)
|
523
517
|
@events.parse_error e, client
|
524
518
|
else
|
525
|
-
client.
|
519
|
+
status, headers, res_body = lowlevel_error(e, client.env)
|
520
|
+
write_response(status, headers, res_body, buffer, requests, client)
|
526
521
|
@events.unknown_error e, nil, "Read"
|
527
522
|
end
|
528
523
|
end
|
529
524
|
|
530
525
|
# A fallback rack response if +@app+ raises as exception.
|
531
526
|
#
|
532
|
-
def lowlevel_error(e, env, status=500)
|
527
|
+
def lowlevel_error(e, env, status = 500)
|
533
528
|
if handler = @options[:lowlevel_error_handler]
|
534
529
|
if handler.arity == 1
|
535
|
-
|
530
|
+
handler_status, headers, res_body = handler.call(e)
|
536
531
|
elsif handler.arity == 2
|
537
|
-
|
532
|
+
handler_status, headers, res_body = handler.call(e, env)
|
538
533
|
else
|
539
|
-
|
534
|
+
handler_status, headers, res_body = handler.call(e, env, status)
|
540
535
|
end
|
536
|
+
return [handler_status || status, headers || {}, res_body || []]
|
541
537
|
end
|
542
538
|
|
543
539
|
if @leak_stack_on_error
|
data/lib/puma/single.rb
CHANGED
File without changes
|
data/lib/puma/state_file.rb
CHANGED
@@ -1,15 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'yaml'
|
4
|
-
|
5
3
|
module Puma
|
4
|
+
|
5
|
+
# Puma::Launcher uses StateFile to write a yaml file for use with Puma::ControlCLI.
|
6
|
+
#
|
7
|
+
# In previous versions of Puma, YAML was used to read/write the state file.
|
8
|
+
# Since Puma is similar to Bundler/RubyGems in that it may load before one's app
|
9
|
+
# does, minimizing the dependencies that may be shared with the app is desired.
|
10
|
+
#
|
11
|
+
# At present, it only works with numeric and string values. It is still a valid
|
12
|
+
# yaml file, and the CI tests parse it with Psych.
|
13
|
+
#
|
6
14
|
class StateFile
|
15
|
+
|
16
|
+
ALLOWED_FIELDS = %w!control_url control_auth_token pid running_from!
|
17
|
+
|
18
|
+
# @deprecated 6.0.0
|
19
|
+
FIELDS = ALLOWED_FIELDS
|
20
|
+
|
7
21
|
def initialize
|
8
22
|
@options = {}
|
9
23
|
end
|
10
24
|
|
11
25
|
def save(path, permission = nil)
|
12
|
-
contents =
|
26
|
+
contents = "---\n".dup
|
27
|
+
@options.each do |k,v|
|
28
|
+
next unless ALLOWED_FIELDS.include? k
|
29
|
+
case v
|
30
|
+
when Numeric
|
31
|
+
contents << "#{k}: #{v}\n"
|
32
|
+
when String
|
33
|
+
next if v.strip.empty?
|
34
|
+
contents << (k == 'running_from' || v.to_s.include?(' ') ?
|
35
|
+
"#{k}: \"#{v}\"\n" : "#{k}: #{v}\n")
|
36
|
+
end
|
37
|
+
end
|
13
38
|
if permission
|
14
39
|
File.write path, contents, mode: 'wb:UTF-8'
|
15
40
|
else
|
@@ -18,12 +43,21 @@ module Puma
|
|
18
43
|
end
|
19
44
|
|
20
45
|
def load(path)
|
21
|
-
|
46
|
+
File.read(path).lines.each do |line|
|
47
|
+
next if line.start_with? '#'
|
48
|
+
k,v = line.split ':', 2
|
49
|
+
next unless v && ALLOWED_FIELDS.include?(k)
|
50
|
+
v = v.strip
|
51
|
+
@options[k] =
|
52
|
+
case v
|
53
|
+
when /\A\d+\z/ then v.to_i
|
54
|
+
when /\A\d+\.\d+\z/ then v.to_f
|
55
|
+
else v.gsub(/\A"|"\z/, '')
|
56
|
+
end
|
57
|
+
end
|
22
58
|
end
|
23
59
|
|
24
|
-
|
25
|
-
|
26
|
-
FIELDS.each do |f|
|
60
|
+
ALLOWED_FIELDS.each do |f|
|
27
61
|
define_method f do
|
28
62
|
@options[f]
|
29
63
|
end
|
data/lib/puma/systemd.rb
CHANGED
File without changes
|
data/lib/puma/thread_pool.rb
CHANGED
@@ -72,7 +72,7 @@ module Puma
|
|
72
72
|
attr_accessor :out_of_band_hook # @version 5.0.0
|
73
73
|
|
74
74
|
def self.clean_thread_locals
|
75
|
-
Thread.current.keys.each do |key| # rubocop: disable
|
75
|
+
Thread.current.keys.each do |key| # rubocop: disable Style/HashEachMethods
|
76
76
|
Thread.current[key] = nil unless key == :__recursive_key__
|
77
77
|
end
|
78
78
|
end
|
@@ -102,7 +102,7 @@ module Puma
|
|
102
102
|
@spawned += 1
|
103
103
|
|
104
104
|
th = Thread.new(@spawned) do |spawned|
|
105
|
-
Puma.set_thread_name '%s
|
105
|
+
Puma.set_thread_name '%s tp %03i' % [@name, spawned]
|
106
106
|
todo = @todo
|
107
107
|
block = @block
|
108
108
|
mutex = @mutex
|
data/lib/puma/util.rb
CHANGED
File without changes
|
data/lib/puma.rb
CHANGED
File without changes
|
data/lib/rack/handler/puma.rb
CHANGED
File without changes
|
data/tools/Dockerfile
CHANGED
data/tools/trickletest.rb
CHANGED
File without changes
|
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: 5.
|
4
|
+
version: 5.6.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.2.29
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Puma is a simple, fast, threaded, and highly parallel HTTP 1.1 server for
|