puma 3.6.2 → 3.7.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.

@@ -1,10 +1,6 @@
1
1
  major, minor, patch = RUBY_VERSION.split('.').map { |v| v.to_i }
2
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
3
+ if major == 1 && minor == 9 && patch == 3 && RUBY_PATCHLEVEL < 125
8
4
  require 'puma/rack/backports/uri/common_193'
9
5
  else
10
6
  require 'uri/common'
@@ -1,5 +1,4 @@
1
1
  require 'rack/handler'
2
- require 'puma'
3
2
 
4
3
  module Rack
5
4
  module Handler
@@ -10,7 +9,11 @@ module Rack
10
9
  }
11
10
 
12
11
  def self.run(app, options = {})
13
- options = DEFAULT_OPTIONS.merge(options)
12
+ require 'puma/configuration'
13
+ require 'puma/events'
14
+ require 'puma/launcher'
15
+
16
+ options = DEFAULT_OPTIONS.merge(options)
14
17
 
15
18
  conf = ::Puma::Configuration.new(options) do |c|
16
19
  c.quiet
@@ -32,6 +35,10 @@ module Rack
32
35
 
33
36
  if host && (host[0,1] == '.' || host[0,1] == '/')
34
37
  c.bind "unix://#{host}"
38
+ elsif host && host =~ /^ssl:\/\//
39
+ uri = URI.parse(host)
40
+ uri.port ||= options[:Port] || ::Puma::Configuration::DefaultTCPPort
41
+ c.bind uri.to_s
35
42
  else
36
43
  host ||= ::Puma::Configuration::DefaultTCPHost
37
44
  port = options[:Port] || ::Puma::Configuration::DefaultTCPPort
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.license = "BSD-3-Clause"
27
27
  s.rdoc_options = ["--main", "README.md"]
28
28
  s.require_paths = ["lib"]
29
- s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
29
+ s.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
30
30
  s.rubyforge_project = "puma"
31
31
  s.rubygems_version = "1.8.25"
32
32
  s.summary = "Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications"
@@ -22,16 +22,21 @@ Init script to manage multiple Puma servers on the same box using start-stop-dae
22
22
 
23
23
  Puma apps are held in /etc/puma.conf by default. It's mainly a CSV file and every line represents one app. Here's the syntax:
24
24
 
25
- app-path,user,config-file-path,log-file-path
25
+ app-path,user,config-file-path,log-file-path,environment-variables
26
26
 
27
27
  You can add an instance by editing the file or running the following command:
28
28
 
29
29
  sudo /etc/init.d/puma add /path/to/app user /path/to/app/config/puma.rb /path/to/app/log/puma.log
30
30
 
31
- The config and log paths are optional parameters and default to:
31
+ The config and log paths, as well as the environment variables, are optional parameters and default to:
32
32
 
33
33
  * config: /path/to/app/*config/puma.rb*
34
34
  * log: /path/to/app/*log/puma.log*
35
+ * environment: (empty)
36
+
37
+ Multiple environment variables need to be separated by a semicolon, e.g.
38
+
39
+ FOO=1;BAR=2
35
40
 
36
41
  To remove an app, simply delete the line from the config file or run:
37
42
 
@@ -414,7 +414,7 @@ case "$1" in
414
414
  echo " Add a Puma: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
415
415
  echo " config and log are optionals."
416
416
  echo " Remove a Puma: $SCRIPTNAME remove /path/to/app"
417
- echo " On a Puma: $SCRIPTNAME {start|stop|status|restart} PUMA-NAME" >&2
417
+ echo " On a Puma: $SCRIPTNAME {start|stop|status|restart|phased-restart} PUMA-NAME" >&2
418
418
  exit 3
419
419
  ;;
420
420
  esac
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: 3.6.2
4
+ version: 3.7.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: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2017-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '1.1'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '2.0'
36
+ version: '3.0'
37
37
  type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '1.1'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '2.0'
46
+ version: '3.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake-compiler
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -85,7 +85,7 @@ extensions:
85
85
  - ext/puma_http11/extconf.rb
86
86
  extra_rdoc_files:
87
87
  - DEPLOYMENT.md
88
- - History.txt
88
+ - History.md
89
89
  - Manifest.txt
90
90
  - README.md
91
91
  - docs/nginx.md
@@ -97,7 +97,7 @@ extra_rdoc_files:
97
97
  files:
98
98
  - DEPLOYMENT.md
99
99
  - Gemfile
100
- - History.txt
100
+ - History.md
101
101
  - LICENSE
102
102
  - Manifest.txt
103
103
  - README.md
@@ -148,8 +148,6 @@ files:
148
148
  - lib/puma/null_io.rb
149
149
  - lib/puma/plugin.rb
150
150
  - lib/puma/plugin/tmp_restart.rb
151
- - lib/puma/rack/backports/uri/common_18.rb
152
- - lib/puma/rack/backports/uri/common_192.rb
153
151
  - lib/puma/rack/backports/uri/common_193.rb
154
152
  - lib/puma/rack/builder.rb
155
153
  - lib/puma/rack/urlmap.rb
@@ -186,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
184
  requirements:
187
185
  - - ">="
188
186
  - !ruby/object:Gem::Version
189
- version: 1.8.7
187
+ version: 1.9.3
190
188
  required_rubygems_version: !ruby/object:Gem::Requirement
191
189
  requirements:
192
190
  - - ">="
@@ -1,59 +0,0 @@
1
- # :stopdoc:
2
-
3
- # Stolen from ruby core's uri/common.rb, with modifications to support 1.8.x
4
- #
5
- # https://github.com/ruby/ruby/blob/trunk/lib/uri/common.rb
6
- #
7
- #
8
-
9
- module URI
10
- begin
11
- TBLENCWWWCOMP_ = {} # :nodoc:
12
- 256.times do |i|
13
- TBLENCWWWCOMP_[i.chr] = '%%%02X' % i
14
- end
15
- TBLENCWWWCOMP_[' '] = '+'
16
- TBLENCWWWCOMP_.freeze
17
- TBLDECWWWCOMP_ = {} # :nodoc:
18
- 256.times do |i|
19
- h, l = i>>4, i&15
20
- TBLDECWWWCOMP_['%%%X%X' % [h, l]] = i.chr
21
- TBLDECWWWCOMP_['%%%x%X' % [h, l]] = i.chr
22
- TBLDECWWWCOMP_['%%%X%x' % [h, l]] = i.chr
23
- TBLDECWWWCOMP_['%%%x%x' % [h, l]] = i.chr
24
- end
25
- TBLDECWWWCOMP_['+'] = ' '
26
- TBLDECWWWCOMP_.freeze
27
- rescue Exception
28
- end
29
-
30
- # Encode given +s+ to URL-encoded form data.
31
- #
32
- # This method doesn't convert *, -, ., 0-9, A-Z, _, a-z, but does convert SP
33
- # (ASCII space) to + and converts others to %XX.
34
- #
35
- # This is an implementation of
36
- # http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
37
- #
38
- # See URI.decode_www_form_component, URI.encode_www_form
39
- def self.encode_www_form_component(s)
40
- str = s.to_s
41
- if RUBY_VERSION < "1.9" && $KCODE =~ /u/i
42
- str.gsub(/([^ a-zA-Z0-9_.-]+)/) do
43
- '%' + $1.unpack('H2' * Rack::Utils.bytesize($1)).join('%').upcase
44
- end.tr(' ', '+')
45
- else
46
- str.gsub(/[^*\-.0-9A-Z_a-z]/) {|m| TBLENCWWWCOMP_[m]}
47
- end
48
- end
49
-
50
- # Decode given +str+ of URL-encoded form data.
51
- #
52
- # This decodes + to SP.
53
- #
54
- # See URI.encode_www_form_component, URI.decode_www_form
55
- def self.decode_www_form_component(str, enc=nil)
56
- raise ArgumentError, "invalid %-encoding (#{str})" unless /\A(?:%[0-9a-fA-F]{2}|[^%])*\z/ =~ str
57
- str.gsub(/\+|%[0-9a-fA-F]{2}/) {|m| TBLDECWWWCOMP_[m]}
58
- end
59
- end
@@ -1,55 +0,0 @@
1
- # :stopdoc:
2
-
3
- # Stolen from ruby core's uri/common.rb @32618ba to fix DoS issues in 1.9.2
4
- #
5
- # https://github.com/ruby/ruby/blob/32618ba7438a2247042bba9b5d85b5d49070f5e5/lib/uri/common.rb
6
- #
7
- # Issue:
8
- # http://redmine.ruby-lang.org/issues/5149
9
- #
10
- # Relevant Fixes:
11
- # https://github.com/ruby/ruby/commit/b5f91deee04aa6ccbe07c23c8222b937c22a799b
12
- # https://github.com/ruby/ruby/commit/93177c1e5c3906abf14472ae0b905d8b5c72ce1b
13
- #
14
- # This should probably be removed once there is a Ruby 1.9.2 patch level that
15
- # includes this fix.
16
-
17
- require 'uri/common'
18
-
19
- module URI
20
- begin
21
- TBLDECWWWCOMP_ = {} unless const_defined?(:TBLDECWWWCOMP_) #:nodoc:
22
- if TBLDECWWWCOMP_.empty?
23
- 256.times do |i|
24
- h, l = i>>4, i&15
25
- TBLDECWWWCOMP_['%%%X%X' % [h, l]] = i.chr
26
- TBLDECWWWCOMP_['%%%x%X' % [h, l]] = i.chr
27
- TBLDECWWWCOMP_['%%%X%x' % [h, l]] = i.chr
28
- TBLDECWWWCOMP_['%%%x%x' % [h, l]] = i.chr
29
- end
30
- TBLDECWWWCOMP_['+'] = ' '
31
- TBLDECWWWCOMP_.freeze
32
- end
33
- rescue Exception
34
- end
35
-
36
- def self.decode_www_form(str, enc=Encoding::UTF_8)
37
- return [] if str.empty?
38
- unless /\A#{WFKV_}=#{WFKV_}(?:[;&]#{WFKV_}=#{WFKV_})*\z/o =~ str
39
- raise ArgumentError, "invalid data of application/x-www-form-urlencoded (#{str})"
40
- end
41
- ary = []
42
- $&.scan(/([^=;&]+)=([^;&]*)/) do
43
- ary << [decode_www_form_component($1, enc), decode_www_form_component($2, enc)]
44
- end
45
- ary
46
- end
47
-
48
- def self.decode_www_form_component(str, enc=Encoding::UTF_8)
49
- raise ArgumentError, "invalid %-encoding (#{str})" unless /\A[^%]*(?:%\h\h[^%]*)*\z/ =~ str
50
- str.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc)
51
- end
52
-
53
- remove_const :WFKV_ if const_defined?(:WFKV_)
54
- WFKV_ = '(?:[^%#=;&]*(?:%\h\h[^%#=;&]*)*)' # :nodoc:
55
- end