puma 4.2.0 → 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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3b55d391fabcf1d06ef5dec1bf340baa8f79bb259eda2c82b00f325fc43575a
4
- data.tar.gz: c880b55b1277a9046d92c761dcf60d7bff9a059c9a0d54985607919c50a0653a
3
+ metadata.gz: c9951b68e8fbc1851402ee152ae08df16681868b48cb8dd1ab94c409b12125b2
4
+ data.tar.gz: 250163367ab0f96dc67feb73e1105c48d20d69d5ad77095ce741d5ac63927e79
5
5
  SHA512:
6
- metadata.gz: d384912b42fd6e839793c912c1bf534aae25a29b03ec1eaaaad3b8ececc786f3f72df22194479c38720d01c9463bf7868fb19ade35a3fe399f17f2757a99612d
7
- data.tar.gz: 7b6b2f827c6c4c2bf33f6a88f00f8cae55a36b4f7bffe6b36c3d98d880e9f83c6c75398ded27c1ab1e5e6e1bad2dbc3f72713abcc1d37ba60ccdfb8d1c7764c1
6
+ metadata.gz: 58c353b21da37a71ca1cca25f75ebc70bba0c1db97a3384d0169fb8258f5952a0ce80260330492fd7767d9ab423a834afd399d3ef1035cbbc248b0d767af8f06
7
+ data.tar.gz: 8143eeaccf5b22c0d99e2eb3c2852278833a927d31c6f7e7ed333866f3ce9753b67fe6b3dfd447078cae1269606075c2977a8d389b4169cc3738feacdf28c5db
data/History.md CHANGED
@@ -1,11 +1,15 @@
1
- ## Master
2
-
3
1
  * Features
4
2
  * Your feature goes here (#Github Number)
5
3
 
6
4
  * Bugfixes
7
5
  * Your bugfix goes here (#Github Number)
8
6
 
7
+ ## 4.2.1 / 2019-10-07
8
+
9
+ * 3 bugfixes
10
+ * Fix socket activation of systemd (pre-existing) unix binder files (#1842, #1988)
11
+ * Deal with multiple calls to bind correctly (#1986, #1994, #2006)
12
+ * Accepts symbols for `verify_mode` (#1222)
9
13
 
10
14
  ## 4.2.0 / 2019-09-23
11
15
 
data/README.md CHANGED
@@ -304,6 +304,8 @@ Which can also be used to run a single test case:
304
304
  $ bundle exec m test/test_binder.rb:37
305
305
  ```
306
306
 
307
+ If you open a pull request with a change that doesn't need to be noted in the changelog ([`History.md`](History.md)), add the text `[changelog skip]` to the pull request title to skip [the changelog check](https://github.com/puma/puma/pull/1991).
308
+
307
309
  ## License
308
310
 
309
311
  Puma is copyright Evan Phoenix and contributors, licensed under the BSD 3-Clause license. See the included LICENSE file for details.
@@ -1,15 +1,22 @@
1
1
  ## Plugins
2
2
 
3
- Puma 3.0 added support for plugins that can augment configuration and service operations.
3
+ Puma 3.0 added support for plugins that can augment configuration and service
4
+ operations.
4
5
 
5
6
  2 canonical plugins to look to aid in development of further plugins:
6
7
 
7
- * [tmp\_restart](https://github.com/puma/puma/blob/master/lib/puma/plugin/tmp_restart.rb): Restarts the server if the file `tmp/restart.txt` is touched
8
- * [heroku](https://github.com/puma/puma-heroku/blob/master/lib/puma/plugin/heroku.rb): Packages up the default configuration used by puma on Heroku
8
+ * [tmp\_restart](https://github.com/puma/puma/blob/master/lib/puma/plugin/tmp_restart.rb):
9
+ Restarts the server if the file `tmp/restart.txt` is touched
10
+ * [heroku](https://github.com/puma/puma-heroku/blob/master/lib/puma/plugin/heroku.rb):
11
+ Packages up the default configuration used by puma on Heroku
9
12
 
10
- Plugins are activated in a puma configuration file (such as `config/puma.rb'`) by adding `plugin "name"`, such as `plugin "heroku"`.
13
+ Plugins are activated in a puma configuration file (such as `config/puma.rb'`)
14
+ by adding `plugin "name"`, such as `plugin "heroku"`.
11
15
 
12
- Plugins are activated based simply on path requirements so, activating the `heroku` plugin will simply be doing `require "puma/plugin/heroku"`. This allows gems to provide multiple plugins (as well as unrelated gems to provide puma plugins).
16
+ Plugins are activated based simply on path requirements so, activating the
17
+ `heroku` plugin will simply be doing `require "puma/plugin/heroku"`. This
18
+ allows gems to provide multiple plugins (as well as unrelated gems to provide
19
+ puma plugins).
13
20
 
14
21
  The `tmp_restart` plugin is bundled with puma, so it can always be used.
15
22
 
@@ -17,12 +24,15 @@ To use the `heroku` plugin, add `puma-heroku` to your Gemfile or install it.
17
24
 
18
25
  ### API
19
26
 
20
- At present, there are 2 hooks that plugins can use: `start` and `config`.
27
+ ## Server-wide hooks
21
28
 
22
- `start` runs when the server has started and allows the plugin to start other functionality to augment puma.
29
+ Plugins can use a couple of hooks at server level: `start` and `config`.
23
30
 
24
- `config` runs when the server is being configured and is passed a `Puma::DSL` object that can be used to add additional configuration.
31
+ `start` runs when the server has started and allows the plugin to start other
32
+ functionality to augment puma.
25
33
 
26
- Any public methods in `Puma::Plugin` are the public API that any plugin may use.
34
+ `config` runs when the server is being configured and is passed a `Puma::DSL`
35
+ object that can be used to add additional configuration.
27
36
 
28
- In the future, more hooks and APIs will be added.
37
+ Any public methods in `Puma::Plugin` are the public API that any plugin may
38
+ use.
@@ -105,6 +105,7 @@ module Puma
105
105
  io = add_tcp_listener uri.host, uri.port, opt, bak
106
106
 
107
107
  @ios.each do |i|
108
+ next unless TCPServer === i
108
109
  addr = if i.local_address.ipv6?
109
110
  "[#{i.local_address.ip_unpack[0]}]:#{i.local_address.ip_unpack[1]}"
110
111
  else
@@ -360,7 +361,7 @@ module Puma
360
361
  # Tell the server to listen on +path+ as a UNIX domain socket.
361
362
  #
362
363
  def add_unix_listener(path, umask=nil, mode=nil, backlog=1024)
363
- @unix_paths << path
364
+ @unix_paths << path unless File.exist? path
364
365
 
365
366
  # Let anyone connect by default
366
367
  umask ||= 0
@@ -398,7 +399,7 @@ module Puma
398
399
  end
399
400
 
400
401
  def inherit_unix_listener(path, fd)
401
- @unix_paths << path
402
+ @unix_paths << path unless File.exist? path
402
403
 
403
404
  if fd.kind_of? TCPServer
404
405
  s = fd
@@ -419,7 +420,8 @@ module Puma
419
420
  io.close
420
421
  uri = URI.parse(l)
421
422
  next unless uri.scheme == 'unix'
422
- File.unlink("#{uri.host}#{uri.path}")
423
+ unix_path = "#{uri.host}#{uri.path}"
424
+ File.unlink unix_path if @unix_paths.include? unix_path
423
425
  end
424
426
  end
425
427
 
@@ -9,8 +9,8 @@ class IO
9
9
  end
10
10
 
11
11
  require 'puma/detect'
12
- require 'puma/delegation'
13
12
  require 'tempfile'
13
+ require 'forwardable'
14
14
 
15
15
  if Puma::IS_JRUBY
16
16
  # We have to work around some OpenSSL buffer/io-readiness bugs
@@ -41,7 +41,7 @@ module Puma
41
41
  EmptyBody = NullIO.new
42
42
 
43
43
  include Puma::Const
44
- extend Puma::Delegation
44
+ extend Forwardable
45
45
 
46
46
  def initialize(io, env=nil)
47
47
  @io = io
@@ -83,7 +83,7 @@ module Puma
83
83
 
84
84
  attr_accessor :remote_addr_header
85
85
 
86
- forward :closed?, :@io
86
+ def_delegators :@io, :closed?
87
87
 
88
88
  def inspect
89
89
  "#<Puma::Client:0x#{object_id.to_s(16)} @ready=#{@ready.inspect}>"
@@ -529,7 +529,6 @@ module Puma
529
529
  @suicide_pipe.close
530
530
  read.close
531
531
  @wakeup.close
532
- @launcher.close_binder_unix_paths
533
532
  end
534
533
  end
535
534
 
@@ -100,7 +100,7 @@ module Puma
100
100
  # too taxing on performance.
101
101
  module Const
102
102
 
103
- PUMA_VERSION = VERSION = "4.2.0".freeze
103
+ PUMA_VERSION = VERSION = "4.2.1".freeze
104
104
  CODE_NAME = "Distant Airhorns".freeze
105
105
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
106
106
 
@@ -396,7 +396,7 @@ module Puma
396
396
  # keystore_pass: password
397
397
  # }
398
398
  def ssl_bind(host, port, opts)
399
- verify = opts.fetch(:verify_mode, 'none')
399
+ verify = opts.fetch(:verify_mode, 'none').to_s
400
400
  no_tlsv1 = opts.fetch(:no_tlsv1, 'false')
401
401
  no_tlsv1_1 = opts.fetch(:no_tlsv1_1, 'false')
402
402
  ca_additions = "&ca=#{opts[:ca]}" if ['peer', 'force_peer'].include?(verify)
@@ -184,6 +184,7 @@ module Puma
184
184
  when :exit
185
185
  # nothing
186
186
  end
187
+ @binder.close_unix_paths
187
188
  end
188
189
 
189
190
  # Return which tcp port the launcher is using, if it's using TCP
@@ -204,10 +205,6 @@ module Puma
204
205
  @binder.close_listeners
205
206
  end
206
207
 
207
- def close_binder_unix_paths
208
- @binder.close_unix_paths
209
- end
210
-
211
208
  private
212
209
 
213
210
  # If configured, write the pid of the current process out
@@ -9,13 +9,13 @@ require 'puma/null_io'
9
9
  require 'puma/reactor'
10
10
  require 'puma/client'
11
11
  require 'puma/binder'
12
- require 'puma/delegation'
13
12
  require 'puma/accept_nonblock'
14
13
  require 'puma/util'
15
14
 
16
15
  require 'puma/puma_http11'
17
16
 
18
17
  require 'socket'
18
+ require 'forwardable'
19
19
 
20
20
  module Puma
21
21
 
@@ -32,7 +32,7 @@ module Puma
32
32
  class Server
33
33
 
34
34
  include Puma::Const
35
- extend Puma::Delegation
35
+ extend Forwardable
36
36
 
37
37
  attr_reader :thread
38
38
  attr_reader :events
@@ -89,10 +89,7 @@ module Puma
89
89
 
90
90
  attr_accessor :binder, :leak_stack_on_error, :early_hints
91
91
 
92
- forward :add_tcp_listener, :@binder
93
- forward :add_ssl_listener, :@binder
94
- forward :add_unix_listener, :@binder
95
- forward :connected_port, :@binder
92
+ def_delegators :@binder, :add_tcp_listener, :add_ssl_listener, :add_unix_listener, :connected_port
96
93
 
97
94
  def inherit_binder(bind)
98
95
  @binder = bind
@@ -118,7 +118,6 @@ module Puma
118
118
  rescue Interrupt
119
119
  # Swallow it
120
120
  end
121
- @launcher.close_binder_unix_paths
122
121
  end
123
122
  end
124
123
  end
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.2.0
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-09-23 00:00:00.000000000 Z
11
+ date: 2019-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nio4r
@@ -80,7 +80,6 @@ files:
80
80
  - lib/puma/const.rb
81
81
  - lib/puma/control_cli.rb
82
82
  - lib/puma/convenient.rb
83
- - lib/puma/delegation.rb
84
83
  - lib/puma/detect.rb
85
84
  - lib/puma/dsl.rb
86
85
  - lib/puma/events.rb
@@ -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