puma 3.12.6 → 6.2.2

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +1775 -451
  3. data/LICENSE +23 -20
  4. data/README.md +193 -65
  5. data/bin/puma-wild +3 -9
  6. data/docs/architecture.md +59 -21
  7. data/docs/compile_options.md +55 -0
  8. data/docs/deployment.md +69 -58
  9. data/docs/fork_worker.md +31 -0
  10. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  11. data/docs/images/puma-connection-flow.png +0 -0
  12. data/docs/images/puma-general-arch.png +0 -0
  13. data/docs/jungle/README.md +9 -0
  14. data/{tools → docs}/jungle/rc.d/README.md +1 -1
  15. data/{tools → docs}/jungle/rc.d/puma +2 -2
  16. data/{tools → docs}/jungle/rc.d/puma.conf +0 -0
  17. data/docs/kubernetes.md +66 -0
  18. data/docs/nginx.md +2 -2
  19. data/docs/plugins.md +22 -12
  20. data/docs/rails_dev_mode.md +28 -0
  21. data/docs/restart.md +47 -22
  22. data/docs/signals.md +13 -11
  23. data/docs/stats.md +142 -0
  24. data/docs/systemd.md +94 -120
  25. data/docs/testing_benchmarks_local_files.md +150 -0
  26. data/docs/testing_test_rackup_ci_files.md +36 -0
  27. data/ext/puma_http11/PumaHttp11Service.java +2 -2
  28. data/ext/puma_http11/ext_help.h +1 -1
  29. data/ext/puma_http11/extconf.rb +61 -3
  30. data/ext/puma_http11/http11_parser.c +103 -117
  31. data/ext/puma_http11/http11_parser.h +2 -2
  32. data/ext/puma_http11/http11_parser.java.rl +22 -38
  33. data/ext/puma_http11/http11_parser.rl +3 -3
  34. data/ext/puma_http11/http11_parser_common.rl +6 -6
  35. data/ext/puma_http11/mini_ssl.c +361 -99
  36. data/ext/puma_http11/no_ssl/PumaHttp11Service.java +15 -0
  37. data/ext/puma_http11/org/jruby/puma/Http11.java +108 -116
  38. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +84 -99
  39. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +248 -92
  40. data/ext/puma_http11/puma_http11.c +49 -57
  41. data/lib/puma/app/status.rb +71 -49
  42. data/lib/puma/binder.rb +242 -150
  43. data/lib/puma/cli.rb +38 -34
  44. data/lib/puma/client.rb +387 -244
  45. data/lib/puma/cluster/worker.rb +180 -0
  46. data/lib/puma/cluster/worker_handle.rb +97 -0
  47. data/lib/puma/cluster.rb +261 -243
  48. data/lib/puma/commonlogger.rb +21 -14
  49. data/lib/puma/configuration.rb +116 -88
  50. data/lib/puma/const.rb +101 -100
  51. data/lib/puma/control_cli.rb +115 -70
  52. data/lib/puma/detect.rb +33 -2
  53. data/lib/puma/dsl.rb +731 -134
  54. data/lib/puma/error_logger.rb +113 -0
  55. data/lib/puma/events.rb +16 -112
  56. data/lib/puma/io_buffer.rb +42 -5
  57. data/lib/puma/jruby_restart.rb +2 -59
  58. data/lib/puma/json_serialization.rb +96 -0
  59. data/lib/puma/launcher/bundle_pruner.rb +104 -0
  60. data/lib/puma/launcher.rb +184 -133
  61. data/lib/puma/log_writer.rb +147 -0
  62. data/lib/puma/minissl/context_builder.rb +92 -0
  63. data/lib/puma/minissl.rb +246 -70
  64. data/lib/puma/null_io.rb +18 -1
  65. data/lib/puma/plugin/systemd.rb +90 -0
  66. data/lib/puma/plugin/tmp_restart.rb +3 -1
  67. data/lib/puma/plugin.rb +7 -13
  68. data/lib/puma/rack/builder.rb +7 -9
  69. data/lib/puma/rack/urlmap.rb +2 -0
  70. data/lib/puma/rack_default.rb +21 -4
  71. data/lib/puma/reactor.rb +85 -316
  72. data/lib/puma/request.rb +665 -0
  73. data/lib/puma/runner.rb +94 -69
  74. data/lib/puma/sd_notify.rb +149 -0
  75. data/lib/puma/server.rb +314 -771
  76. data/lib/puma/single.rb +20 -74
  77. data/lib/puma/state_file.rb +45 -8
  78. data/lib/puma/thread_pool.rb +142 -92
  79. data/lib/puma/util.rb +22 -10
  80. data/lib/puma.rb +60 -5
  81. data/lib/rack/handler/puma.rb +113 -91
  82. data/tools/Dockerfile +16 -0
  83. data/tools/trickletest.rb +0 -1
  84. metadata +54 -32
  85. data/ext/puma_http11/io_buffer.c +0 -155
  86. data/lib/puma/accept_nonblock.rb +0 -23
  87. data/lib/puma/compat.rb +0 -14
  88. data/lib/puma/convenient.rb +0 -25
  89. data/lib/puma/daemon_ext.rb +0 -33
  90. data/lib/puma/delegation.rb +0 -13
  91. data/lib/puma/java_io_buffer.rb +0 -47
  92. data/lib/puma/rack/backports/uri/common_193.rb +0 -33
  93. data/lib/puma/tcp_logger.rb +0 -41
  94. data/tools/jungle/README.md +0 -19
  95. data/tools/jungle/init.d/README.md +0 -61
  96. data/tools/jungle/init.d/puma +0 -421
  97. data/tools/jungle/init.d/run-puma +0 -18
  98. data/tools/jungle/upstart/README.md +0 -61
  99. data/tools/jungle/upstart/puma-manager.conf +0 -31
  100. data/tools/jungle/upstart/puma.conf +0 -69
data/lib/puma.rb CHANGED
@@ -1,23 +1,78 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Standard libraries
2
4
  require 'socket'
3
5
  require 'tempfile'
4
- require 'time'
5
- require 'etc'
6
6
  require 'uri'
7
7
  require 'stringio'
8
8
 
9
9
  require 'thread'
10
10
 
11
+ # use require, see https://github.com/puma/puma/pull/2381
12
+ require 'puma/puma_http11'
13
+
14
+ require_relative 'puma/detect'
15
+ require_relative 'puma/json_serialization'
16
+
11
17
  module Puma
12
- autoload :Const, 'puma/const'
13
- autoload :Server, 'puma/server'
14
- autoload :Launcher, 'puma/launcher'
18
+ # when Puma is loaded via `Puma::CLI`, all files are loaded via
19
+ # `require_relative`. The below are for non-standard loading
20
+ autoload :Const, "#{__dir__}/puma/const"
21
+ autoload :Server, "#{__dir__}/puma/server"
22
+ autoload :Launcher, "#{__dir__}/puma/launcher"
23
+ autoload :LogWriter, "#{__dir__}/puma/log_writer"
24
+
25
+ # at present, MiniSSL::Engine is only defined in extension code (puma_http11),
26
+ # not in minissl.rb
27
+ HAS_SSL = const_defined?(:MiniSSL, false) && MiniSSL.const_defined?(:Engine, false)
15
28
 
29
+ HAS_UNIX_SOCKET = Object.const_defined?(:UNIXSocket) && !IS_WINDOWS
30
+
31
+ if HAS_SSL
32
+ require_relative 'puma/minissl'
33
+ else
34
+ module MiniSSL
35
+ # this class is defined so that it exists when Puma is compiled
36
+ # without ssl support, as Server and Reactor use it in rescue statements.
37
+ class SSLError < StandardError ; end
38
+ end
39
+ end
40
+
41
+ def self.ssl?
42
+ HAS_SSL
43
+ end
44
+
45
+ def self.abstract_unix_socket?
46
+ @abstract_unix ||=
47
+ if HAS_UNIX_SOCKET
48
+ begin
49
+ ::UNIXServer.new("\0puma.temp.unix").close
50
+ true
51
+ rescue ArgumentError # darwin
52
+ false
53
+ end
54
+ else
55
+ false
56
+ end
57
+ end
58
+
59
+ # @!attribute [rw] stats_object=
16
60
  def self.stats_object=(val)
17
61
  @get_stats = val
18
62
  end
19
63
 
64
+ # @!attribute [rw] stats_object
20
65
  def self.stats
66
+ Puma::JSONSerialization.generate @get_stats.stats
67
+ end
68
+
69
+ # @!attribute [r] stats_hash
70
+ # @version 5.0.0
71
+ def self.stats_hash
21
72
  @get_stats.stats
22
73
  end
74
+
75
+ def self.set_thread_name(name)
76
+ Thread.current.name = "puma #{name}"
77
+ end
23
78
  end
@@ -1,115 +1,137 @@
1
- require 'rack/handler'
2
-
3
- module Rack
4
- module Handler
5
- module Puma
6
- DEFAULT_OPTIONS = {
7
- :Verbose => false,
8
- :Silent => false
9
- }
10
-
11
- def self.config(app, options = {})
12
- require 'puma'
13
- require 'puma/configuration'
14
- require 'puma/events'
15
- require 'puma/launcher'
16
-
17
- default_options = DEFAULT_OPTIONS.dup
18
-
19
- # Libraries pass in values such as :Port and there is no way to determine
20
- # if it is a default provided by the library or a special value provided
21
- # by the user. A special key `user_supplied_options` can be passed. This
22
- # contains an array of all explicitly defined user options. We then
23
- # know that all other values are defaults
24
- if user_supplied_options = options.delete(:user_supplied_options)
25
- (options.keys - user_supplied_options).each do |k|
26
- default_options[k] = options.delete(k)
27
- end
1
+ # frozen_string_literal: true
2
+
3
+ # This module is used as an 'include' file in code at bottom of file
4
+ module Puma
5
+ module RackHandler
6
+ DEFAULT_OPTIONS = {
7
+ :Verbose => false,
8
+ :Silent => false
9
+ }
10
+
11
+ def config(app, options = {})
12
+ require_relative '../../puma'
13
+ require_relative '../../puma/configuration'
14
+ require_relative '../../puma/log_writer'
15
+ require_relative '../../puma/launcher'
16
+
17
+ default_options = DEFAULT_OPTIONS.dup
18
+
19
+ # Libraries pass in values such as :Port and there is no way to determine
20
+ # if it is a default provided by the library or a special value provided
21
+ # by the user. A special key `user_supplied_options` can be passed. This
22
+ # contains an array of all explicitly defined user options. We then
23
+ # know that all other values are defaults
24
+ if user_supplied_options = options.delete(:user_supplied_options)
25
+ (options.keys - user_supplied_options).each do |k|
26
+ default_options[k] = options.delete(k)
28
27
  end
28
+ end
29
29
 
30
- conf = ::Puma::Configuration.new(options, default_options) do |user_config, file_config, default_config|
31
- user_config.quiet
32
-
33
- if options.delete(:Verbose)
34
- app = Rack::CommonLogger.new(app, STDOUT)
35
- end
30
+ @events = options[:events] || ::Puma::Events.new
36
31
 
37
- if options[:environment]
38
- user_config.environment options[:environment]
39
- end
32
+ conf = ::Puma::Configuration.new(options, default_options.merge({events: @events})) do |user_config, file_config, default_config|
33
+ if options.delete(:Verbose)
34
+ require 'rack/common_logger'
35
+ app = ::Rack::CommonLogger.new(app, STDOUT)
36
+ end
40
37
 
41
- if options[:Threads]
42
- min, max = options.delete(:Threads).split(':', 2)
43
- user_config.threads min, max
44
- end
38
+ if options[:environment]
39
+ user_config.environment options[:environment]
40
+ end
45
41
 
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
42
+ if options[:Threads]
43
+ min, max = options.delete(:Threads).split(':', 2)
44
+ user_config.threads min, max
45
+ end
51
46
 
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)
47
+ if options[:Host] || options[:Port]
48
+ host = options[:Host] || default_options[:Host]
49
+ port = options[:Port] || default_options[:Port]
50
+ self.set_host_port_to_config(host, port, user_config)
51
+ end
56
52
 
57
- user_config.app app
53
+ if default_options[:Host]
54
+ file_config.set_default_host(default_options[:Host])
58
55
  end
59
- conf
56
+ self.set_host_port_to_config(default_options[:Host], default_options[:Port], default_config)
57
+
58
+ user_config.app app
60
59
  end
60
+ conf
61
+ end
61
62
 
63
+ def run(app, **options)
64
+ conf = self.config(app, options)
62
65
 
66
+ log_writer = options.delete(:Silent) ? ::Puma::LogWriter.strings : ::Puma::LogWriter.stdio
63
67
 
64
- def self.run(app, options = {})
65
- conf = self.config(app, options)
68
+ launcher = ::Puma::Launcher.new(conf, :log_writer => log_writer, events: @events)
66
69
 
67
- events = options.delete(:Silent) ? ::Puma::Events.strings : ::Puma::Events.stdio
70
+ yield launcher if block_given?
71
+ begin
72
+ launcher.run
73
+ rescue Interrupt
74
+ puts "* Gracefully stopping, waiting for requests to finish"
75
+ launcher.stop
76
+ puts "* Goodbye!"
77
+ end
78
+ end
68
79
 
69
- launcher = ::Puma::Launcher.new(conf, :events => events)
80
+ def valid_options
81
+ {
82
+ "Host=HOST" => "Hostname to listen on (default: localhost)",
83
+ "Port=PORT" => "Port to listen on (default: 8080)",
84
+ "Threads=MIN:MAX" => "min:max threads to use (default 0:16)",
85
+ "Verbose" => "Don't report each request (default: false)"
86
+ }
87
+ end
88
+
89
+ def set_host_port_to_config(host, port, config)
90
+ config.clear_binds! if host || port
91
+
92
+ if host && (host[0,1] == '.' || host[0,1] == '/')
93
+ config.bind "unix://#{host}"
94
+ elsif host && host =~ /^ssl:\/\//
95
+ uri = URI.parse(host)
96
+ uri.port ||= port || ::Puma::Configuration::DEFAULTS[:tcp_port]
97
+ config.bind uri.to_s
98
+ else
70
99
 
71
- yield launcher if block_given?
72
- begin
73
- launcher.run
74
- rescue Interrupt
75
- puts "* Gracefully stopping, waiting for requests to finish"
76
- launcher.stop
77
- puts "* Goodbye!"
100
+ if host
101
+ port ||= ::Puma::Configuration::DEFAULTS[:tcp_port]
102
+ end
103
+
104
+ if port
105
+ host ||= ::Puma::Configuration::DEFAULTS[:tcp_host]
106
+ config.port port, host
78
107
  end
79
108
  end
109
+ end
110
+ end
111
+ end
80
112
 
81
- def self.valid_options
82
- {
83
- "Host=HOST" => "Hostname to listen on (default: localhost)",
84
- "Port=PORT" => "Port to listen on (default: 8080)",
85
- "Threads=MIN:MAX" => "min:max threads to use (default 0:16)",
86
- "Verbose" => "Don't report each request (default: false)"
87
- }
113
+ # rackup was removed in Rack 3, it is now a separate gem
114
+ if Object.const_defined? :Rackup
115
+ module Rackup
116
+ module Handler
117
+ module Puma
118
+ class << self
119
+ include ::Puma::RackHandler
120
+ end
88
121
  end
89
- private
90
- def self.set_host_port_to_config(host, port, config)
91
- config.clear_binds! if host || port
92
-
93
- if host && (host[0,1] == '.' || host[0,1] == '/')
94
- config.bind "unix://#{host}"
95
- elsif host && host =~ /^ssl:\/\//
96
- uri = URI.parse(host)
97
- uri.port ||= port || ::Puma::Configuration::DefaultTCPPort
98
- config.bind uri.to_s
99
- else
100
-
101
- if host
102
- port ||= ::Puma::Configuration::DefaultTCPPort
103
- end
104
-
105
- if port
106
- host ||= ::Puma::Configuration::DefaultTCPHost
107
- config.port port, host
108
- end
122
+ register :puma, Puma
123
+ end
124
+ end
125
+ else
126
+ do_register = Object.const_defined?(:Rack) && Rack::RELEASE < '3'
127
+ module Rack
128
+ module Handler
129
+ module Puma
130
+ class << self
131
+ include ::Puma::RackHandler
109
132
  end
110
133
  end
111
134
  end
112
-
113
- register :puma, Puma
114
135
  end
136
+ ::Rack::Handler.register(:puma, ::Rack::Handler::Puma) if do_register
115
137
  end
data/tools/Dockerfile ADDED
@@ -0,0 +1,16 @@
1
+ # Use this Dockerfile to create minimal reproductions of issues
2
+
3
+ FROM ruby:3.1
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
data/tools/trickletest.rb CHANGED
@@ -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,18 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.6
4
+ version: 6.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
12
- dependencies: []
13
- description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
11
+ date: 1980-01-01 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'
27
+ description: Puma is a simple, fast, threaded, and highly parallel HTTP 1.1 server
14
28
  for Ruby/Rack applications. Puma is intended for use in both development and production
15
- environments. It's great for highly concurrent Ruby implementations such as Rubinius
29
+ environments. It's great for highly parallel Ruby implementations such as Rubinius
16
30
  and JRuby as well as as providing process worker support to support CRuby well.
17
31
  email:
18
32
  - evan@phx.io
@@ -30,15 +44,26 @@ files:
30
44
  - bin/puma-wild
31
45
  - bin/pumactl
32
46
  - docs/architecture.md
47
+ - docs/compile_options.md
33
48
  - docs/deployment.md
49
+ - docs/fork_worker.md
34
50
  - docs/images/puma-connection-flow-no-reactor.png
35
51
  - docs/images/puma-connection-flow.png
36
52
  - docs/images/puma-general-arch.png
53
+ - docs/jungle/README.md
54
+ - docs/jungle/rc.d/README.md
55
+ - docs/jungle/rc.d/puma
56
+ - docs/jungle/rc.d/puma.conf
57
+ - docs/kubernetes.md
37
58
  - docs/nginx.md
38
59
  - docs/plugins.md
60
+ - docs/rails_dev_mode.md
39
61
  - docs/restart.md
40
62
  - docs/signals.md
63
+ - docs/stats.md
41
64
  - docs/systemd.md
65
+ - docs/testing_benchmarks_local_files.md
66
+ - docs/testing_test_rackup_ci_files.md
42
67
  - ext/puma_http11/PumaHttp11Service.java
43
68
  - ext/puma_http11/ext_help.h
44
69
  - ext/puma_http11/extconf.rb
@@ -47,68 +72,65 @@ files:
47
72
  - ext/puma_http11/http11_parser.java.rl
48
73
  - ext/puma_http11/http11_parser.rl
49
74
  - ext/puma_http11/http11_parser_common.rl
50
- - ext/puma_http11/io_buffer.c
51
75
  - ext/puma_http11/mini_ssl.c
76
+ - ext/puma_http11/no_ssl/PumaHttp11Service.java
52
77
  - ext/puma_http11/org/jruby/puma/Http11.java
53
78
  - ext/puma_http11/org/jruby/puma/Http11Parser.java
54
79
  - ext/puma_http11/org/jruby/puma/MiniSSL.java
55
80
  - ext/puma_http11/puma_http11.c
56
81
  - lib/puma.rb
57
- - lib/puma/accept_nonblock.rb
58
82
  - lib/puma/app/status.rb
59
83
  - lib/puma/binder.rb
60
84
  - lib/puma/cli.rb
61
85
  - lib/puma/client.rb
62
86
  - lib/puma/cluster.rb
87
+ - lib/puma/cluster/worker.rb
88
+ - lib/puma/cluster/worker_handle.rb
63
89
  - lib/puma/commonlogger.rb
64
- - lib/puma/compat.rb
65
90
  - lib/puma/configuration.rb
66
91
  - lib/puma/const.rb
67
92
  - lib/puma/control_cli.rb
68
- - lib/puma/convenient.rb
69
- - lib/puma/daemon_ext.rb
70
- - lib/puma/delegation.rb
71
93
  - lib/puma/detect.rb
72
94
  - lib/puma/dsl.rb
95
+ - lib/puma/error_logger.rb
73
96
  - lib/puma/events.rb
74
97
  - lib/puma/io_buffer.rb
75
- - lib/puma/java_io_buffer.rb
76
98
  - lib/puma/jruby_restart.rb
99
+ - lib/puma/json_serialization.rb
77
100
  - lib/puma/launcher.rb
101
+ - lib/puma/launcher/bundle_pruner.rb
102
+ - lib/puma/log_writer.rb
78
103
  - lib/puma/minissl.rb
104
+ - lib/puma/minissl/context_builder.rb
79
105
  - lib/puma/null_io.rb
80
106
  - lib/puma/plugin.rb
107
+ - lib/puma/plugin/systemd.rb
81
108
  - lib/puma/plugin/tmp_restart.rb
82
- - lib/puma/rack/backports/uri/common_193.rb
83
109
  - lib/puma/rack/builder.rb
84
110
  - lib/puma/rack/urlmap.rb
85
111
  - lib/puma/rack_default.rb
86
112
  - lib/puma/reactor.rb
113
+ - lib/puma/request.rb
87
114
  - lib/puma/runner.rb
115
+ - lib/puma/sd_notify.rb
88
116
  - lib/puma/server.rb
89
117
  - lib/puma/single.rb
90
118
  - lib/puma/state_file.rb
91
- - lib/puma/tcp_logger.rb
92
119
  - lib/puma/thread_pool.rb
93
120
  - lib/puma/util.rb
94
121
  - lib/rack/handler/puma.rb
95
- - tools/jungle/README.md
96
- - tools/jungle/init.d/README.md
97
- - tools/jungle/init.d/puma
98
- - tools/jungle/init.d/run-puma
99
- - tools/jungle/rc.d/README.md
100
- - tools/jungle/rc.d/puma
101
- - tools/jungle/rc.d/puma.conf
102
- - tools/jungle/upstart/README.md
103
- - tools/jungle/upstart/puma-manager.conf
104
- - tools/jungle/upstart/puma.conf
122
+ - tools/Dockerfile
105
123
  - tools/trickletest.rb
106
- homepage: http://puma.io
124
+ homepage: https://puma.io
107
125
  licenses:
108
126
  - BSD-3-Clause
109
127
  metadata:
110
- msys2_mingw_dependencies: openssl
111
- post_install_message:
128
+ bug_tracker_uri: https://github.com/puma/puma/issues
129
+ changelog_uri: https://github.com/puma/puma/blob/master/History.md
130
+ homepage_uri: https://puma.io
131
+ source_code_uri: https://github.com/puma/puma
132
+ rubygems_mfa_required: 'true'
133
+ post_install_message:
112
134
  rdoc_options: []
113
135
  require_paths:
114
136
  - lib
@@ -116,16 +138,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
138
  requirements:
117
139
  - - ">="
118
140
  - !ruby/object:Gem::Version
119
- version: '2.2'
141
+ version: '2.4'
120
142
  required_rubygems_version: !ruby/object:Gem::Requirement
121
143
  requirements:
122
144
  - - ">="
123
145
  - !ruby/object:Gem::Version
124
146
  version: '0'
125
147
  requirements: []
126
- rubygems_version: 3.0.3
127
- signing_key:
148
+ rubygems_version: 3.3.20
149
+ signing_key:
128
150
  specification_version: 4
129
- summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
151
+ summary: Puma is a simple, fast, threaded, and highly parallel HTTP 1.1 server for
130
152
  Ruby/Rack applications
131
153
  test_files: []
@@ -1,155 +0,0 @@
1
- #define RSTRING_NOT_MODIFIED 1
2
- #include "ruby.h"
3
-
4
- #include <sys/types.h>
5
-
6
- struct buf_int {
7
- uint8_t* top;
8
- uint8_t* cur;
9
-
10
- size_t size;
11
- };
12
-
13
- #define BUF_DEFAULT_SIZE 4096
14
- #define BUF_TOLERANCE 32
15
-
16
- static void buf_free(struct buf_int* internal) {
17
- xfree(internal->top);
18
- xfree(internal);
19
- }
20
-
21
- static VALUE buf_alloc(VALUE self) {
22
- VALUE buf;
23
- struct buf_int* internal;
24
-
25
- buf = Data_Make_Struct(self, struct buf_int, 0, buf_free, internal);
26
-
27
- internal->size = BUF_DEFAULT_SIZE;
28
- internal->top = ALLOC_N(uint8_t, BUF_DEFAULT_SIZE);
29
- internal->cur = internal->top;
30
-
31
- return buf;
32
- }
33
-
34
- static VALUE buf_append(VALUE self, VALUE str) {
35
- struct buf_int* b;
36
- size_t used, str_len, new_size;
37
-
38
- Data_Get_Struct(self, struct buf_int, b);
39
-
40
- used = b->cur - b->top;
41
-
42
- StringValue(str);
43
- str_len = RSTRING_LEN(str);
44
-
45
- new_size = used + str_len;
46
-
47
- if(new_size > b->size) {
48
- size_t n = b->size + (b->size / 2);
49
- uint8_t* top;
50
- uint8_t* old;
51
-
52
- new_size = (n > new_size ? n : new_size + BUF_TOLERANCE);
53
-
54
- top = ALLOC_N(uint8_t, new_size);
55
- old = b->top;
56
- memcpy(top, old, used);
57
- b->top = top;
58
- b->cur = top + used;
59
- b->size = new_size;
60
- xfree(old);
61
- }
62
-
63
- memcpy(b->cur, RSTRING_PTR(str), str_len);
64
- b->cur += str_len;
65
-
66
- return self;
67
- }
68
-
69
- static VALUE buf_append2(int argc, VALUE* argv, VALUE self) {
70
- struct buf_int* b;
71
- size_t used, new_size;
72
- int i;
73
- VALUE str;
74
-
75
- Data_Get_Struct(self, struct buf_int, b);
76
-
77
- used = b->cur - b->top;
78
- new_size = used;
79
-
80
- for(i = 0; i < argc; i++) {
81
- StringValue(argv[i]);
82
-
83
- str = argv[i];
84
-
85
- new_size += RSTRING_LEN(str);
86
- }
87
-
88
- if(new_size > b->size) {
89
- size_t n = b->size + (b->size / 2);
90
- uint8_t* top;
91
- uint8_t* old;
92
-
93
- new_size = (n > new_size ? n : new_size + BUF_TOLERANCE);
94
-
95
- top = ALLOC_N(uint8_t, new_size);
96
- old = b->top;
97
- memcpy(top, old, used);
98
- b->top = top;
99
- b->cur = top + used;
100
- b->size = new_size;
101
- xfree(old);
102
- }
103
-
104
- for(i = 0; i < argc; i++) {
105
- long str_len;
106
- str = argv[i];
107
- str_len = RSTRING_LEN(str);
108
- memcpy(b->cur, RSTRING_PTR(str), str_len);
109
- b->cur += str_len;
110
- }
111
-
112
- return self;
113
- }
114
-
115
- static VALUE buf_to_str(VALUE self) {
116
- struct buf_int* b;
117
- Data_Get_Struct(self, struct buf_int, b);
118
-
119
- return rb_str_new((const char*)(b->top), b->cur - b->top);
120
- }
121
-
122
- static VALUE buf_used(VALUE self) {
123
- struct buf_int* b;
124
- Data_Get_Struct(self, struct buf_int, b);
125
-
126
- return INT2FIX(b->cur - b->top);
127
- }
128
-
129
- static VALUE buf_capa(VALUE self) {
130
- struct buf_int* b;
131
- Data_Get_Struct(self, struct buf_int, b);
132
-
133
- return INT2FIX(b->size);
134
- }
135
-
136
- static VALUE buf_reset(VALUE self) {
137
- struct buf_int* b;
138
- Data_Get_Struct(self, struct buf_int, b);
139
-
140
- b->cur = b->top;
141
- return self;
142
- }
143
-
144
- void Init_io_buffer(VALUE puma) {
145
- VALUE buf = rb_define_class_under(puma, "IOBuffer", rb_cObject);
146
-
147
- rb_define_alloc_func(buf, buf_alloc);
148
- rb_define_method(buf, "<<", buf_append, 1);
149
- rb_define_method(buf, "append", buf_append2, -1);
150
- rb_define_method(buf, "to_str", buf_to_str, 0);
151
- rb_define_method(buf, "to_s", buf_to_str, 0);
152
- rb_define_method(buf, "used", buf_used, 0);
153
- rb_define_method(buf, "capacity", buf_capa, 0);
154
- rb_define_method(buf, "reset", buf_reset, 0);
155
- }
@@ -1,23 +0,0 @@
1
- require 'openssl'
2
-
3
- module OpenSSL
4
- module SSL
5
- class SSLServer
6
- unless public_method_defined? :accept_nonblock
7
- def accept_nonblock
8
- sock = @svr.accept_nonblock
9
-
10
- begin
11
- ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx)
12
- ssl.sync_close = true
13
- ssl.accept if @start_immediately
14
- ssl
15
- rescue SSLError => ex
16
- sock.close
17
- raise ex
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end