puma 3.0.0.rc1 → 5.0.0.beta1

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 (91) hide show
  1. checksums.yaml +5 -5
  2. data/{History.txt → History.md} +703 -70
  3. data/LICENSE +23 -20
  4. data/README.md +173 -163
  5. data/docs/architecture.md +37 -0
  6. data/{DEPLOYMENT.md → docs/deployment.md} +28 -6
  7. data/docs/fork_worker.md +31 -0
  8. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  9. data/docs/images/puma-connection-flow.png +0 -0
  10. data/docs/images/puma-general-arch.png +0 -0
  11. data/docs/jungle/README.md +13 -0
  12. data/docs/jungle/rc.d/README.md +74 -0
  13. data/docs/jungle/rc.d/puma +61 -0
  14. data/docs/jungle/rc.d/puma.conf +10 -0
  15. data/{tools → docs}/jungle/upstart/README.md +0 -0
  16. data/{tools → docs}/jungle/upstart/puma-manager.conf +0 -0
  17. data/{tools → docs}/jungle/upstart/puma.conf +1 -1
  18. data/docs/nginx.md +2 -2
  19. data/docs/plugins.md +38 -0
  20. data/docs/restart.md +41 -0
  21. data/docs/signals.md +57 -3
  22. data/docs/systemd.md +228 -0
  23. data/ext/puma_http11/PumaHttp11Service.java +2 -2
  24. data/ext/puma_http11/extconf.rb +16 -0
  25. data/ext/puma_http11/http11_parser.c +287 -468
  26. data/ext/puma_http11/http11_parser.h +1 -0
  27. data/ext/puma_http11/http11_parser.java.rl +21 -37
  28. data/ext/puma_http11/http11_parser.rl +10 -9
  29. data/ext/puma_http11/http11_parser_common.rl +4 -4
  30. data/ext/puma_http11/mini_ssl.c +159 -10
  31. data/ext/puma_http11/org/jruby/puma/Http11.java +108 -116
  32. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +99 -132
  33. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +30 -6
  34. data/ext/puma_http11/puma_http11.c +6 -38
  35. data/lib/puma.rb +25 -5
  36. data/lib/puma/accept_nonblock.rb +7 -1
  37. data/lib/puma/app/status.rb +53 -26
  38. data/lib/puma/binder.rb +150 -119
  39. data/lib/puma/cli.rb +56 -38
  40. data/lib/puma/client.rb +277 -80
  41. data/lib/puma/cluster.rb +326 -130
  42. data/lib/puma/commonlogger.rb +21 -20
  43. data/lib/puma/configuration.rb +160 -161
  44. data/lib/puma/const.rb +50 -47
  45. data/lib/puma/control_cli.rb +104 -63
  46. data/lib/puma/detect.rb +13 -1
  47. data/lib/puma/dsl.rb +463 -114
  48. data/lib/puma/events.rb +22 -13
  49. data/lib/puma/io_buffer.rb +9 -5
  50. data/lib/puma/jruby_restart.rb +2 -59
  51. data/lib/puma/launcher.rb +195 -105
  52. data/lib/puma/minissl.rb +110 -4
  53. data/lib/puma/minissl/context_builder.rb +76 -0
  54. data/lib/puma/null_io.rb +9 -14
  55. data/lib/puma/plugin.rb +32 -12
  56. data/lib/puma/plugin/tmp_restart.rb +19 -6
  57. data/lib/puma/rack/builder.rb +7 -5
  58. data/lib/puma/rack/urlmap.rb +11 -8
  59. data/lib/puma/rack_default.rb +2 -0
  60. data/lib/puma/reactor.rb +242 -32
  61. data/lib/puma/runner.rb +41 -30
  62. data/lib/puma/server.rb +265 -183
  63. data/lib/puma/single.rb +22 -63
  64. data/lib/puma/state_file.rb +9 -2
  65. data/lib/puma/thread_pool.rb +179 -68
  66. data/lib/puma/util.rb +3 -11
  67. data/lib/rack/handler/puma.rb +60 -11
  68. data/tools/Dockerfile +16 -0
  69. data/tools/trickletest.rb +1 -2
  70. metadata +35 -99
  71. data/COPYING +0 -55
  72. data/Gemfile +0 -13
  73. data/Manifest.txt +0 -79
  74. data/Rakefile +0 -158
  75. data/docs/config.md +0 -0
  76. data/ext/puma_http11/io_buffer.c +0 -155
  77. data/lib/puma/capistrano.rb +0 -94
  78. data/lib/puma/compat.rb +0 -18
  79. data/lib/puma/convenient.rb +0 -23
  80. data/lib/puma/daemon_ext.rb +0 -31
  81. data/lib/puma/delegation.rb +0 -11
  82. data/lib/puma/java_io_buffer.rb +0 -45
  83. data/lib/puma/rack/backports/uri/common_18.rb +0 -56
  84. data/lib/puma/rack/backports/uri/common_192.rb +0 -52
  85. data/lib/puma/rack/backports/uri/common_193.rb +0 -29
  86. data/lib/puma/tcp_logger.rb +0 -32
  87. data/puma.gemspec +0 -52
  88. data/tools/jungle/README.md +0 -9
  89. data/tools/jungle/init.d/README.md +0 -54
  90. data/tools/jungle/init.d/puma +0 -394
  91. data/tools/jungle/init.d/run-puma +0 -3
@@ -1,14 +1,6 @@
1
- major, minor, patch = RUBY_VERSION.split('.').map { |v| v.to_i }
2
-
3
- if major == 1 && minor < 9
4
- require 'puma/rack/backports/uri/common_18'
5
- elsif major == 1 && minor == 9 && patch == 2 && RUBY_PATCHLEVEL <= 328 && RUBY_ENGINE != 'jruby'
6
- require 'puma/rack/backports/uri/common_192'
7
- elsif major == 1 && minor == 9 && patch == 3 && RUBY_PATCHLEVEL < 125
8
- require 'puma/rack/backports/uri/common_193'
9
- else
10
- require 'uri/common'
11
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri/common'
12
4
 
13
5
  module Puma
14
6
  module Util
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rack/handler'
2
- require 'puma'
3
4
 
4
5
  module Rack
5
6
  module Handler
@@ -9,30 +10,57 @@ module Rack
9
10
  :Silent => false
10
11
  }
11
12
 
12
- def self.run(app, options = {})
13
- options = DEFAULT_OPTIONS.merge(options)
13
+ def self.config(app, options = {})
14
+ require 'puma'
15
+ require 'puma/configuration'
16
+ require 'puma/events'
17
+ require 'puma/launcher'
18
+
19
+ default_options = DEFAULT_OPTIONS.dup
20
+
21
+ # Libraries pass in values such as :Port and there is no way to determine
22
+ # if it is a default provided by the library or a special value provided
23
+ # by the user. A special key `user_supplied_options` can be passed. This
24
+ # contains an array of all explicitly defined user options. We then
25
+ # know that all other values are defaults
26
+ if user_supplied_options = options.delete(:user_supplied_options)
27
+ (options.keys - user_supplied_options).each do |k|
28
+ default_options[k] = options.delete(k)
29
+ end
30
+ end
14
31
 
15
- conf = ::Puma::Configuration.new do |c|
32
+ conf = ::Puma::Configuration.new(options, default_options) do |user_config, file_config, default_config|
16
33
  if options.delete(:Verbose)
17
34
  app = Rack::CommonLogger.new(app, STDOUT)
18
35
  end
19
36
 
20
37
  if options[:environment]
21
- c.environment options[:environment]
38
+ user_config.environment options[:environment]
22
39
  end
23
40
 
24
41
  if options[:Threads]
25
42
  min, max = options.delete(:Threads).split(':', 2)
26
- c.threads min, max
43
+ user_config.threads min, max
27
44
  end
28
45
 
29
- host = options[:Host] || ::Puma::Configuration::DefaultTCPHost
30
- port = options[:Port] || ::Puma::Configuration::DefaultTCPPort
46
+ if options[:Host] || options[:Port]
47
+ host = options[:Host] || default_options[:Host]
48
+ port = options[:Port] || default_options[:Port]
49
+ self.set_host_port_to_config(host, port, user_config)
50
+ end
31
51
 
32
- c.port port, host
52
+ if default_options[:Host]
53
+ file_config.set_default_host(default_options[:Host])
54
+ end
55
+ self.set_host_port_to_config(default_options[:Host], default_options[:Port], default_config)
33
56
 
34
- c.app app
57
+ user_config.app app
35
58
  end
59
+ conf
60
+ end
61
+
62
+ def self.run(app, **options)
63
+ conf = self.config(app, options)
36
64
 
37
65
  events = options.delete(:Silent) ? ::Puma::Events.strings : ::Puma::Events.stdio
38
66
 
@@ -56,9 +84,30 @@ module Rack
56
84
  "Verbose" => "Don't report each request (default: false)"
57
85
  }
58
86
  end
87
+
88
+ def self.set_host_port_to_config(host, port, config)
89
+ config.clear_binds! if host || port
90
+
91
+ if host && (host[0,1] == '.' || host[0,1] == '/')
92
+ config.bind "unix://#{host}"
93
+ elsif host && host =~ /^ssl:\/\//
94
+ uri = URI.parse(host)
95
+ uri.port ||= port || ::Puma::Configuration::DefaultTCPPort
96
+ config.bind uri.to_s
97
+ else
98
+
99
+ if host
100
+ port ||= ::Puma::Configuration::DefaultTCPPort
101
+ end
102
+
103
+ if port
104
+ host ||= ::Puma::Configuration::DefaultTCPHost
105
+ config.port port, host
106
+ end
107
+ end
108
+ end
59
109
  end
60
110
 
61
111
  register :puma, Puma
62
112
  end
63
113
  end
64
-
@@ -0,0 +1,16 @@
1
+ # Use this Dockerfile to create minimal reproductions of issues
2
+
3
+ FROM ruby:2.6
4
+
5
+ # throw errors if Gemfile has been modified since Gemfile.lock
6
+ RUN bundle config --global frozen 1
7
+
8
+ WORKDIR /usr/src/app
9
+
10
+ COPY . .
11
+ RUN gem install bundler
12
+ RUN bundle install
13
+ RUN bundle exec rake compile
14
+
15
+ EXPOSE 9292
16
+ CMD bundle exec bin/puma test/rackup/hello.ru
@@ -31,14 +31,13 @@ st = "GET / HTTP/1.1\r\nHost: www.zedshaw.com\r\nContent-Type: text/plain\r\nCon
31
31
  puts "length: #{content.length}"
32
32
 
33
33
  threads = []
34
- ARGV[1].to_i.times do
34
+ ARGV[1].to_i.times do
35
35
  t = Thread.new do
36
36
  size = 100
37
37
  puts ">>>> #{size} sized chunks"
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,81 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc1
4
+ version: 5.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-20 00:00:00.000000000 Z
11
+ date: 2020-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rdoc
14
+ name: nio4r
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '4.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '4.0'
27
- - !ruby/object:Gem::Dependency
28
- name: rack
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '1.1'
34
- - - "<"
35
18
  - !ruby/object:Gem::Version
36
19
  version: '2.0'
37
- type: :development
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '1.1'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '2.0'
47
- - !ruby/object:Gem::Dependency
48
- name: rake-compiler
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '0.8'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '0.8'
61
- - !ruby/object:Gem::Dependency
62
- name: hoe
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '3.14'
68
- type: :development
20
+ type: :runtime
69
21
  prerelease: false
70
22
  version_requirements: !ruby/object:Gem::Requirement
71
23
  requirements:
72
24
  - - "~>"
73
25
  - !ruby/object:Gem::Version
74
- version: '3.14'
26
+ version: '2.0'
75
27
  description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
76
28
  for Ruby/Rack applications. Puma is intended for use in both development and production
77
- environments. In order to get the best throughput, it is highly recommended that
78
- you use a Ruby implementation with real threads like Rubinius or JRuby.
29
+ environments. It's great for highly concurrent Ruby implementations such as Rubinius
30
+ and JRuby as well as as providing process worker support to support CRuby well.
79
31
  email:
80
32
  - evan@phx.io
81
33
  executables:
@@ -83,32 +35,32 @@ executables:
83
35
  - pumactl
84
36
  extensions:
85
37
  - ext/puma_http11/extconf.rb
86
- extra_rdoc_files:
87
- - DEPLOYMENT.md
88
- - History.txt
89
- - Manifest.txt
90
- - README.md
91
- - docs/config.md
92
- - docs/nginx.md
93
- - docs/signals.md
94
- - tools/jungle/README.md
95
- - tools/jungle/init.d/README.md
96
- - tools/jungle/upstart/README.md
38
+ extra_rdoc_files: []
97
39
  files:
98
- - COPYING
99
- - DEPLOYMENT.md
100
- - Gemfile
101
- - History.txt
40
+ - History.md
102
41
  - LICENSE
103
- - Manifest.txt
104
42
  - README.md
105
- - Rakefile
106
43
  - bin/puma
107
44
  - bin/puma-wild
108
45
  - bin/pumactl
109
- - docs/config.md
46
+ - docs/architecture.md
47
+ - docs/deployment.md
48
+ - docs/fork_worker.md
49
+ - docs/images/puma-connection-flow-no-reactor.png
50
+ - docs/images/puma-connection-flow.png
51
+ - docs/images/puma-general-arch.png
52
+ - docs/jungle/README.md
53
+ - docs/jungle/rc.d/README.md
54
+ - docs/jungle/rc.d/puma
55
+ - docs/jungle/rc.d/puma.conf
56
+ - docs/jungle/upstart/README.md
57
+ - docs/jungle/upstart/puma-manager.conf
58
+ - docs/jungle/upstart/puma.conf
110
59
  - docs/nginx.md
60
+ - docs/plugins.md
61
+ - docs/restart.md
111
62
  - docs/signals.md
63
+ - docs/systemd.md
112
64
  - ext/puma_http11/PumaHttp11Service.java
113
65
  - ext/puma_http11/ext_help.h
114
66
  - ext/puma_http11/extconf.rb
@@ -117,7 +69,6 @@ files:
117
69
  - ext/puma_http11/http11_parser.java.rl
118
70
  - ext/puma_http11/http11_parser.rl
119
71
  - ext/puma_http11/http11_parser_common.rl
120
- - ext/puma_http11/io_buffer.c
121
72
  - ext/puma_http11/mini_ssl.c
122
73
  - ext/puma_http11/org/jruby/puma/Http11.java
123
74
  - ext/puma_http11/org/jruby/puma/Http11Parser.java
@@ -127,32 +78,24 @@ files:
127
78
  - lib/puma/accept_nonblock.rb
128
79
  - lib/puma/app/status.rb
129
80
  - lib/puma/binder.rb
130
- - lib/puma/capistrano.rb
131
81
  - lib/puma/cli.rb
132
82
  - lib/puma/client.rb
133
83
  - lib/puma/cluster.rb
134
84
  - lib/puma/commonlogger.rb
135
- - lib/puma/compat.rb
136
85
  - lib/puma/configuration.rb
137
86
  - lib/puma/const.rb
138
87
  - lib/puma/control_cli.rb
139
- - lib/puma/convenient.rb
140
- - lib/puma/daemon_ext.rb
141
- - lib/puma/delegation.rb
142
88
  - lib/puma/detect.rb
143
89
  - lib/puma/dsl.rb
144
90
  - lib/puma/events.rb
145
91
  - lib/puma/io_buffer.rb
146
- - lib/puma/java_io_buffer.rb
147
92
  - lib/puma/jruby_restart.rb
148
93
  - lib/puma/launcher.rb
149
94
  - lib/puma/minissl.rb
95
+ - lib/puma/minissl/context_builder.rb
150
96
  - lib/puma/null_io.rb
151
97
  - lib/puma/plugin.rb
152
98
  - lib/puma/plugin/tmp_restart.rb
153
- - lib/puma/rack/backports/uri/common_18.rb
154
- - lib/puma/rack/backports/uri/common_192.rb
155
- - lib/puma/rack/backports/uri/common_193.rb
156
99
  - lib/puma/rack/builder.rb
157
100
  - lib/puma/rack/urlmap.rb
158
101
  - lib/puma/rack_default.rb
@@ -161,42 +104,35 @@ files:
161
104
  - lib/puma/server.rb
162
105
  - lib/puma/single.rb
163
106
  - lib/puma/state_file.rb
164
- - lib/puma/tcp_logger.rb
165
107
  - lib/puma/thread_pool.rb
166
108
  - lib/puma/util.rb
167
109
  - lib/rack/handler/puma.rb
168
- - puma.gemspec
169
- - tools/jungle/README.md
170
- - tools/jungle/init.d/README.md
171
- - tools/jungle/init.d/puma
172
- - tools/jungle/init.d/run-puma
173
- - tools/jungle/upstart/README.md
174
- - tools/jungle/upstart/puma-manager.conf
175
- - tools/jungle/upstart/puma.conf
110
+ - tools/Dockerfile
176
111
  - tools/trickletest.rb
177
112
  homepage: http://puma.io
178
113
  licenses:
179
114
  - BSD-3-Clause
180
- metadata: {}
115
+ metadata:
116
+ bug_tracker_uri: https://github.com/puma/puma/issues
117
+ changelog_uri: https://github.com/puma/puma/blob/master/History.md
118
+ homepage_uri: http://puma.io
119
+ source_code_uri: https://github.com/puma/puma
181
120
  post_install_message:
182
- rdoc_options:
183
- - "--main"
184
- - README.md
121
+ rdoc_options: []
185
122
  require_paths:
186
123
  - lib
187
124
  required_ruby_version: !ruby/object:Gem::Requirement
188
125
  requirements:
189
126
  - - ">="
190
127
  - !ruby/object:Gem::Version
191
- version: 1.8.7
128
+ version: '2.2'
192
129
  required_rubygems_version: !ruby/object:Gem::Requirement
193
130
  requirements:
194
131
  - - ">"
195
132
  - !ruby/object:Gem::Version
196
133
  version: 1.3.1
197
134
  requirements: []
198
- rubyforge_project:
199
- rubygems_version: 2.5.1
135
+ rubygems_version: 3.1.2
200
136
  signing_key:
201
137
  specification_version: 4
202
138
  summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
data/COPYING DELETED
@@ -1,55 +0,0 @@
1
- Mongrel Web Server (Mongrel) is copyrighted free software by Zed A. Shaw
2
- <zedshaw at zedshaw dot com> You can redistribute it and/or modify it under
3
- either the terms of the GPL or the conditions below:
4
-
5
- 1. You may make and give away verbatim copies of the source form of the
6
- software without restriction, provided that you duplicate all of the
7
- original copyright notices and associated disclaimers.
8
-
9
- 2. You may modify your copy of the software in any way, provided that
10
- you do at least ONE of the following:
11
-
12
- a) place your modifications in the Public Domain or otherwise make them
13
- Freely Available, such as by posting said modifications to Usenet or an
14
- equivalent medium, or by allowing the author to include your
15
- modifications in the software.
16
-
17
- b) use the modified software only within your corporation or
18
- organization.
19
-
20
- c) rename any non-standard executables so the names do not conflict with
21
- standard executables, which must also be provided.
22
-
23
- d) make other distribution arrangements with the author.
24
-
25
- 3. You may distribute the software in object code or executable
26
- form, provided that you do at least ONE of the following:
27
-
28
- a) distribute the executables and library files of the software,
29
- together with instructions (in the manual page or equivalent) on where
30
- to get the original distribution.
31
-
32
- b) accompany the distribution with the machine-readable source of the
33
- software.
34
-
35
- c) give non-standard executables non-standard names, with
36
- instructions on where to get the original software distribution.
37
-
38
- d) make other distribution arrangements with the author.
39
-
40
- 4. You may modify and include the part of the software into any other
41
- software (possibly commercial). But some files in the distribution
42
- are not written by the author, so that they are not under this terms.
43
-
44
- 5. The scripts and library files supplied as input to or produced as
45
- output from the software do not automatically fall under the
46
- copyright of the software, but belong to whomever generated them,
47
- and may be sold commercially, and may be aggregated with this
48
- software.
49
-
50
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
51
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
52
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53
- PURPOSE.
54
-
55
-
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "hoe"
4
- gem "hoe-git"
5
- gem "hoe-ignore"
6
- gem "rdoc"
7
- gem "rake-compiler"
8
- gem "test-unit", "~> 3.0"
9
-
10
- gem "rack"
11
- gem 'minitest', '~> 4.0'
12
-
13
- gem "jruby-openssl", :platform => "jruby"