puma 3.12.2 → 4.2.1

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.

Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +106 -6
  3. data/README.md +91 -43
  4. data/docs/architecture.md +1 -0
  5. data/docs/deployment.md +24 -4
  6. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  7. data/docs/images/puma-connection-flow.png +0 -0
  8. data/docs/images/puma-general-arch.png +0 -0
  9. data/docs/plugins.md +20 -10
  10. data/docs/restart.md +4 -2
  11. data/docs/systemd.md +27 -9
  12. data/ext/puma_http11/PumaHttp11Service.java +2 -0
  13. data/ext/puma_http11/extconf.rb +8 -0
  14. data/ext/puma_http11/http11_parser.c +37 -62
  15. data/ext/puma_http11/http11_parser_common.rl +3 -3
  16. data/ext/puma_http11/mini_ssl.c +78 -8
  17. data/ext/puma_http11/org/jruby/puma/IOBuffer.java +72 -0
  18. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +15 -4
  19. data/lib/puma.rb +8 -0
  20. data/lib/puma/accept_nonblock.rb +7 -1
  21. data/lib/puma/app/status.rb +35 -29
  22. data/lib/puma/binder.rb +39 -5
  23. data/lib/puma/cli.rb +4 -0
  24. data/lib/puma/client.rb +221 -199
  25. data/lib/puma/cluster.rb +53 -30
  26. data/lib/puma/configuration.rb +4 -3
  27. data/lib/puma/const.rb +22 -25
  28. data/lib/puma/control_cli.rb +21 -4
  29. data/lib/puma/dsl.rb +297 -75
  30. data/lib/puma/events.rb +4 -1
  31. data/lib/puma/io_buffer.rb +1 -6
  32. data/lib/puma/launcher.rb +95 -53
  33. data/lib/puma/minissl.rb +35 -17
  34. data/lib/puma/plugin.rb +5 -2
  35. data/lib/puma/plugin/tmp_restart.rb +2 -0
  36. data/lib/puma/rack/builder.rb +2 -0
  37. data/lib/puma/rack/urlmap.rb +2 -0
  38. data/lib/puma/rack_default.rb +2 -0
  39. data/lib/puma/reactor.rb +109 -57
  40. data/lib/puma/runner.rb +4 -3
  41. data/lib/puma/server.rb +59 -62
  42. data/lib/puma/single.rb +3 -3
  43. data/lib/puma/thread_pool.rb +14 -32
  44. data/lib/puma/util.rb +1 -6
  45. data/lib/rack/handler/puma.rb +3 -3
  46. data/tools/docker/Dockerfile +16 -0
  47. data/tools/jungle/init.d/puma +6 -6
  48. data/tools/trickletest.rb +0 -1
  49. metadata +20 -8
  50. data/lib/puma/compat.rb +0 -14
  51. data/lib/puma/daemon_ext.rb +0 -33
  52. data/lib/puma/delegation.rb +0 -13
  53. data/lib/puma/java_io_buffer.rb +0 -47
  54. data/lib/puma/rack/backports/uri/common_193.rb +0 -33
@@ -47,11 +47,11 @@ do_start_one() {
47
47
  PIDFILE=$1/tmp/puma/pid
48
48
  if [ -e $PIDFILE ]; then
49
49
  PID=`cat $PIDFILE`
50
- # If the puma isn't running, run it, otherwise restart it.
50
+ # If the puma is running, restart it, otherwise run it.
51
51
  if ps -p $PID > /dev/null; then
52
- do_start_one_do $1
53
- else
54
52
  do_restart_one $1
53
+ else
54
+ do_start_one_do $1
55
55
  fi
56
56
  else
57
57
  do_start_one_do $1
@@ -106,8 +106,6 @@ do_stop_one() {
106
106
  if [ -e $PIDFILE ]; then
107
107
  PID=`cat $PIDFILE`
108
108
  if ps -p $PID > /dev/null; then
109
- log_daemon_msg "---> Puma $1 isn't running."
110
- else
111
109
  log_daemon_msg "---> About to kill PID `cat $PIDFILE`"
112
110
  if [ "$USE_LOCAL_BUNDLE" -eq 1 ]; then
113
111
  cd $1 && bundle exec pumactl --state $STATEFILE stop
@@ -116,6 +114,8 @@ do_stop_one() {
116
114
  fi
117
115
  # Many daemons don't delete their pidfiles when they exit.
118
116
  rm -f $PIDFILE $STATEFILE
117
+ else
118
+ log_daemon_msg "---> Puma $1 isn't running."
119
119
  fi
120
120
  else
121
121
  log_daemon_msg "---> No puma here..."
@@ -398,7 +398,7 @@ case "$1" in
398
398
  ;;
399
399
  remove)
400
400
  if [ "$#" -lt 2 ]; then
401
- echo "Please, specifiy the app's directory to remove."
401
+ echo "Please, specify the app's directory to remove."
402
402
  exit 1
403
403
  else
404
404
  do_remove $2
@@ -38,7 +38,6 @@ ARGV[1].to_i.times do
38
38
  do_test(st, size)
39
39
  end
40
40
 
41
- t.abort_on_exception = true
42
41
  threads << t
43
42
  end
44
43
 
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.2
4
+ version: 4.2.1
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-12-05 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2019-10-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nio4r
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
13
27
  description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
14
28
  for Ruby/Rack applications. Puma is intended for use in both development and production
15
29
  environments. It's great for highly concurrent Ruby implementations such as Rubinius
@@ -51,6 +65,7 @@ files:
51
65
  - ext/puma_http11/mini_ssl.c
52
66
  - ext/puma_http11/org/jruby/puma/Http11.java
53
67
  - ext/puma_http11/org/jruby/puma/Http11Parser.java
68
+ - ext/puma_http11/org/jruby/puma/IOBuffer.java
54
69
  - ext/puma_http11/org/jruby/puma/MiniSSL.java
55
70
  - ext/puma_http11/puma_http11.c
56
71
  - lib/puma.rb
@@ -61,25 +76,20 @@ files:
61
76
  - lib/puma/client.rb
62
77
  - lib/puma/cluster.rb
63
78
  - lib/puma/commonlogger.rb
64
- - lib/puma/compat.rb
65
79
  - lib/puma/configuration.rb
66
80
  - lib/puma/const.rb
67
81
  - lib/puma/control_cli.rb
68
82
  - lib/puma/convenient.rb
69
- - lib/puma/daemon_ext.rb
70
- - lib/puma/delegation.rb
71
83
  - lib/puma/detect.rb
72
84
  - lib/puma/dsl.rb
73
85
  - lib/puma/events.rb
74
86
  - lib/puma/io_buffer.rb
75
- - lib/puma/java_io_buffer.rb
76
87
  - lib/puma/jruby_restart.rb
77
88
  - lib/puma/launcher.rb
78
89
  - lib/puma/minissl.rb
79
90
  - lib/puma/null_io.rb
80
91
  - lib/puma/plugin.rb
81
92
  - lib/puma/plugin/tmp_restart.rb
82
- - lib/puma/rack/backports/uri/common_193.rb
83
93
  - lib/puma/rack/builder.rb
84
94
  - lib/puma/rack/urlmap.rb
85
95
  - lib/puma/rack_default.rb
@@ -92,6 +102,7 @@ files:
92
102
  - lib/puma/thread_pool.rb
93
103
  - lib/puma/util.rb
94
104
  - lib/rack/handler/puma.rb
105
+ - tools/docker/Dockerfile
95
106
  - tools/jungle/README.md
96
107
  - tools/jungle/init.d/README.md
97
108
  - tools/jungle/init.d/puma
@@ -108,6 +119,7 @@ licenses:
108
119
  - BSD-3-Clause
109
120
  metadata:
110
121
  msys2_mingw_dependencies: openssl
122
+ changelog_uri: https://github.com/puma/puma/blob/master/History.md
111
123
  post_install_message:
112
124
  rdoc_options: []
113
125
  require_paths:
@@ -1,14 +0,0 @@
1
- # Provides code to work properly on 1.8 and 1.9
2
-
3
- class String
4
- unless method_defined? :bytesize
5
- alias_method :bytesize, :size
6
- end
7
-
8
- unless method_defined? :byteslice
9
- def byteslice(*arg)
10
- enc = self.encoding
11
- self.dup.force_encoding(Encoding::ASCII_8BIT).slice(*arg).force_encoding(enc)
12
- end
13
- end
14
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Process
4
-
5
- # This overrides the default version because it is broken if it
6
- # exists.
7
-
8
- if respond_to? :daemon
9
- class << self
10
- remove_method :daemon
11
- end
12
- end
13
-
14
- def self.daemon(nochdir=false, noclose=false)
15
- exit if fork # Parent exits, child continues.
16
-
17
- Process.setsid # Become session leader.
18
-
19
- exit if fork # Zap session leader. See [1].
20
-
21
- Dir.chdir "/" unless nochdir # Release old working directory.
22
-
23
- if !noclose
24
- STDIN.reopen File.open("/dev/null", "r")
25
-
26
- null_out = File.open "/dev/null", "w"
27
- STDOUT.reopen null_out
28
- STDERR.reopen null_out
29
- end
30
-
31
- 0
32
- end
33
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Puma
4
- module Delegation
5
- def forward(what, who)
6
- module_eval <<-CODE
7
- def #{what}(*args, &block)
8
- #{who}.#{what}(*args, &block)
9
- end
10
- CODE
11
- end
12
- end
13
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'java'
4
-
5
- # Conservative native JRuby/Java implementation of IOBuffer
6
- # backed by a ByteArrayOutputStream and conversion between
7
- # Ruby String and Java bytes
8
- module Puma
9
- class JavaIOBuffer < java.io.ByteArrayOutputStream
10
- field_reader :buf
11
- end
12
-
13
- class IOBuffer
14
- BUF_DEFAULT_SIZE = 4096
15
-
16
- def initialize
17
- @buf = JavaIOBuffer.new(BUF_DEFAULT_SIZE)
18
- end
19
-
20
- def reset
21
- @buf.reset
22
- end
23
-
24
- def <<(str)
25
- bytes = str.to_java_bytes
26
- @buf.write(bytes, 0, bytes.length)
27
- end
28
-
29
- def append(*strs)
30
- strs.each { |s| self << s; }
31
- end
32
-
33
- def to_s
34
- String.from_java_bytes @buf.to_byte_array
35
- end
36
-
37
- alias_method :to_str, :to_s
38
-
39
- def used
40
- @buf.size
41
- end
42
-
43
- def capacity
44
- @buf.buf.length
45
- end
46
- end
47
- end
@@ -1,33 +0,0 @@
1
- # :stopdoc:
2
-
3
- require 'uri/common'
4
-
5
- # Issue:
6
- # http://bugs.ruby-lang.org/issues/5925
7
- #
8
- # Relevant commit:
9
- # https://github.com/ruby/ruby/commit/edb7cdf1eabaff78dfa5ffedfbc2e91b29fa9ca1
10
-
11
-
12
- module URI
13
- begin
14
- 256.times do |i|
15
- TBLENCWWWCOMP_[i.chr] = '%%%02X' % i
16
- end
17
- TBLENCWWWCOMP_[' '] = '+'
18
- TBLENCWWWCOMP_.freeze
19
-
20
- 256.times do |i|
21
- h, l = i>>4, i&15
22
- TBLDECWWWCOMP_['%%%X%X' % [h, l]] = i.chr
23
- TBLDECWWWCOMP_['%%%x%X' % [h, l]] = i.chr
24
- TBLDECWWWCOMP_['%%%X%x' % [h, l]] = i.chr
25
- TBLDECWWWCOMP_['%%%x%x' % [h, l]] = i.chr
26
- end
27
- TBLDECWWWCOMP_['+'] = ' '
28
- TBLDECWWWCOMP_.freeze
29
- rescue Exception
30
- end
31
- end
32
-
33
- # :startdoc: