puma 3.4.0 → 3.12.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.

Files changed (71) hide show
  1. checksums.yaml +5 -5
  2. data/{History.txt → History.md} +356 -74
  3. data/README.md +143 -227
  4. data/docs/architecture.md +36 -0
  5. data/{DEPLOYMENT.md → docs/deployment.md} +1 -1
  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 +28 -0
  10. data/docs/restart.md +39 -0
  11. data/docs/signals.md +56 -3
  12. data/docs/systemd.md +124 -22
  13. data/ext/puma_http11/extconf.rb +2 -0
  14. data/ext/puma_http11/http11_parser.c +291 -447
  15. data/ext/puma_http11/http11_parser.h +1 -0
  16. data/ext/puma_http11/http11_parser.rl +10 -9
  17. data/ext/puma_http11/http11_parser_common.rl +1 -1
  18. data/ext/puma_http11/io_buffer.c +7 -7
  19. data/ext/puma_http11/mini_ssl.c +67 -6
  20. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +76 -94
  21. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +15 -2
  22. data/ext/puma_http11/puma_http11.c +1 -0
  23. data/lib/puma.rb +13 -5
  24. data/lib/puma/app/status.rb +8 -0
  25. data/lib/puma/binder.rb +46 -21
  26. data/lib/puma/cli.rb +49 -33
  27. data/lib/puma/client.rb +149 -4
  28. data/lib/puma/cluster.rb +55 -13
  29. data/lib/puma/commonlogger.rb +19 -20
  30. data/lib/puma/compat.rb +3 -7
  31. data/lib/puma/configuration.rb +136 -131
  32. data/lib/puma/const.rb +19 -37
  33. data/lib/puma/control_cli.rb +38 -35
  34. data/lib/puma/convenient.rb +3 -3
  35. data/lib/puma/detect.rb +3 -1
  36. data/lib/puma/dsl.rb +86 -57
  37. data/lib/puma/events.rb +17 -13
  38. data/lib/puma/io_buffer.rb +1 -1
  39. data/lib/puma/jruby_restart.rb +0 -1
  40. data/lib/puma/launcher.rb +61 -30
  41. data/lib/puma/minissl.rb +85 -4
  42. data/lib/puma/null_io.rb +6 -13
  43. data/lib/puma/plugin.rb +12 -1
  44. data/lib/puma/plugin/tmp_restart.rb +1 -2
  45. data/lib/puma/rack/builder.rb +3 -0
  46. data/lib/puma/rack/urlmap.rb +9 -8
  47. data/lib/puma/reactor.rb +144 -0
  48. data/lib/puma/runner.rb +27 -1
  49. data/lib/puma/server.rb +135 -33
  50. data/lib/puma/single.rb +17 -3
  51. data/lib/puma/tcp_logger.rb +8 -1
  52. data/lib/puma/thread_pool.rb +70 -20
  53. data/lib/puma/util.rb +1 -5
  54. data/lib/rack/handler/puma.rb +58 -17
  55. data/tools/jungle/README.md +12 -2
  56. data/tools/jungle/init.d/README.md +9 -2
  57. data/tools/jungle/init.d/puma +85 -58
  58. data/tools/jungle/init.d/run-puma +16 -1
  59. data/tools/jungle/rc.d/README.md +74 -0
  60. data/tools/jungle/rc.d/puma +61 -0
  61. data/tools/jungle/rc.d/puma.conf +10 -0
  62. data/tools/jungle/upstart/puma.conf +1 -1
  63. data/tools/trickletest.rb +1 -1
  64. metadata +22 -94
  65. data/Gemfile +0 -13
  66. data/Manifest.txt +0 -78
  67. data/Rakefile +0 -158
  68. data/docs/config.md +0 -0
  69. data/lib/puma/rack/backports/uri/common_18.rb +0 -59
  70. data/lib/puma/rack/backports/uri/common_192.rb +0 -55
  71. data/puma.gemspec +0 -52
data/Rakefile DELETED
@@ -1,158 +0,0 @@
1
- require "hoe"
2
- require "rake/extensiontask"
3
- require "rake/javaextensiontask"
4
-
5
- IS_JRUBY = defined?(RUBY_ENGINE) ? RUBY_ENGINE == "jruby" : false
6
-
7
- Hoe.plugin :git
8
- Hoe.plugin :ignore
9
-
10
- HOE = Hoe.spec "puma" do
11
- self.readme_file = "README.md"
12
- self.urls = %w!http://puma.io https://github.com/puma/puma!
13
-
14
- license "BSD-3-Clause"
15
- developer 'Evan Phoenix', 'evan@phx.io'
16
-
17
- spec_extras[:extensions] = ["ext/puma_http11/extconf.rb"]
18
- spec_extras[:executables] = ['puma', 'pumactl']
19
- spec_extras[:homepage] = self.urls.first
20
-
21
- require_ruby_version ">= 1.8.7"
22
-
23
- dependency "rack", [">= 1.1", "< 2.0"], :development
24
-
25
- extra_dev_deps << ["rake-compiler", "~> 0.8"]
26
- end
27
-
28
- task :prerelease => [:clobber, :check_manifest, :test]
29
-
30
- # hoe/test and rake-compiler don't seem to play well together, so disable
31
- # hoe/test's .gemtest touch file thingy for now
32
- HOE.spec.files -= [".gemtest"]
33
-
34
- include Hoe::Git
35
-
36
- desc "Print the current changelog."
37
- task "changelog" do
38
- tag = ENV["FROM"] || git_tags.last
39
- range = [tag, "HEAD"].compact.join ".."
40
- cmd = "git log #{range} '--format=tformat:%B|||%aN|||%aE|||'"
41
- now = Time.new.strftime "%Y-%m-%d"
42
-
43
- changes = `#{cmd}`.split(/\|\|\|/).each_slice(3).map { |msg, author, email|
44
- msg.split(/\n/).reject { |s| s.empty? }.first
45
- }.flatten.compact
46
-
47
- $changes = Hash.new { |h,k| h[k] = [] }
48
-
49
- codes = {
50
- "!" => :major,
51
- "+" => :minor,
52
- "*" => :minor,
53
- "-" => :bug,
54
- "?" => :unknown,
55
- }
56
-
57
- codes_re = Regexp.escape codes.keys.join
58
-
59
- changes.each do |change|
60
- if change =~ /^\s*([#{codes_re}])\s*(.*)/ then
61
- code, line = codes[$1], $2
62
- else
63
- code, line = codes["?"], change.chomp
64
- end
65
-
66
- $changes[code] << line
67
- end
68
-
69
- puts "=== #{ENV['VERSION'] || 'NEXT'} / #{now}"
70
- puts
71
- changelog_section :major
72
- changelog_section :minor
73
- changelog_section :bug
74
- changelog_section :unknown
75
- puts
76
- end
77
-
78
- # generate extension code using Ragel (C and Java)
79
- desc "Generate extension code (C and Java) using Ragel"
80
- task :ragel
81
-
82
- file 'ext/puma_http11/http11_parser.c' => ['ext/puma_http11/http11_parser.rl'] do |t|
83
- begin
84
- sh "ragel #{t.prerequisites.last} -C -G2 -I ext/puma_http11 -o #{t.name}"
85
- rescue
86
- fail "Could not build wrapper using Ragel (it failed or not installed?)"
87
- end
88
- end
89
- task :ragel => ['ext/puma_http11/http11_parser.c']
90
-
91
- file 'ext/puma_http11/org/jruby/puma/Http11Parser.java' => ['ext/puma_http11/http11_parser.java.rl'] do |t|
92
- begin
93
- sh "ragel #{t.prerequisites.last} -J -G2 -I ext/puma_http11 -o #{t.name}"
94
- rescue
95
- fail "Could not build wrapper using Ragel (it failed or not installed?)"
96
- end
97
- end
98
- task :ragel => ['ext/puma_http11/org/jruby/puma/Http11Parser.java']
99
-
100
- if !IS_JRUBY
101
-
102
- # compile extensions using rake-compiler
103
- # C (MRI, Rubinius)
104
- Rake::ExtensionTask.new("puma_http11", HOE.spec) do |ext|
105
- # place extension inside namespace
106
- ext.lib_dir = "lib/puma"
107
-
108
- ext.cross_compile = true
109
- ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32']
110
- ext.cross_compiling do |spec|
111
- # add fat-binary stub only when cross compiling
112
- spec.files << "lib/puma/puma_http11.rb"
113
- end
114
-
115
- CLEAN.include "lib/puma/{1.8,1.9}"
116
- CLEAN.include "lib/puma/puma_http11.rb"
117
- end
118
-
119
- else
120
-
121
- # Java (JRuby)
122
- Rake::JavaExtensionTask.new("puma_http11", HOE.spec) do |ext|
123
- ext.lib_dir = "lib/puma"
124
- end
125
-
126
- end
127
-
128
- # the following is a fat-binary stub that will be used when
129
- # require 'puma/puma_http11' and will use either 1.8 or 1.9 version depending
130
- # on RUBY_VERSION
131
- file "lib/puma/puma_http11.rb" do |t|
132
- File.open(t.name, "w") do |f|
133
- f.puts "RUBY_VERSION =~ /(\d+.\d+)/"
134
- f.puts 'require "puma/#{$1}/puma_http11"'
135
- end
136
- end
137
-
138
- # tests require extension be compiled, but depend on the platform
139
- if IS_JRUBY
140
- task :test => [:java]
141
- else
142
- task :test => [:compile]
143
- end
144
-
145
- namespace :test do
146
- desc "Run the integration tests"
147
- task :integration do
148
- sh "cd test/shell; sh run.sh"
149
- end
150
-
151
- desc "Run all tests"
152
- if defined?(JRUBY_VERSION) and ENV['TRAVIS']
153
- task :all => :test
154
- else
155
- task :all => [:test, "test:integration"]
156
- end
157
- end
158
-
File without changes
@@ -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
@@ -1,52 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- # This is only used when puma is a git dep from Bundler, so it's a little
4
- # weird.
5
-
6
- d = File.read(File.expand_path("../lib/puma/const.rb", __FILE__))
7
- if d =~ /VERSION = "(\d+\.\d+\.\d+)"/
8
- version = $1
9
- else
10
- version = "0.0.1"
11
- end
12
-
13
- Gem::Specification.new do |s|
14
- s.name = "puma"
15
- s.version = version
16
-
17
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
18
- s.authors = ["Evan Phoenix"]
19
- s.date = `git log --pretty="%ai" -n 1`.split(" ").first
20
- s.description = "Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications. Puma is intended for use in both development and production environments. It's great for highly concurrent Ruby implementations such as Rubinius and JRuby as well as as providing process worker support to support CRuby well."
21
- s.email = ["evan@phx.io"]
22
- s.executables = ["puma", "pumactl"]
23
- s.extensions = ["ext/puma_http11/extconf.rb"]
24
- s.files = `git ls-files`.split($/)
25
- s.homepage = "http://puma.io"
26
- s.license = "BSD-3-Clause"
27
- s.rdoc_options = ["--main", "README.md"]
28
- s.require_paths = ["lib"]
29
- s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
30
- s.rubyforge_project = "puma"
31
- s.rubygems_version = "1.8.25"
32
- s.summary = "Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications"
33
- s.test_files = s.files.grep(/^test/)
34
-
35
- if s.respond_to? :specification_version then
36
- s.specification_version = 3
37
-
38
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
39
- s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
40
- s.add_development_dependency(%q<rake-compiler>, ["~> 0.8.0"])
41
- s.add_development_dependency(%q<hoe>, ["~> 3.6"])
42
- else
43
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
44
- s.add_dependency(%q<rake-compiler>, ["~> 0.8.0"])
45
- s.add_dependency(%q<hoe>, ["~> 3.6"])
46
- end
47
- else
48
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
49
- s.add_dependency(%q<rake-compiler>, ["~> 0.8.0"])
50
- s.add_dependency(%q<hoe>, ["~> 3.6"])
51
- end
52
- end