ed-precompiled_puma 7.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/History.md +3172 -0
  3. data/LICENSE +29 -0
  4. data/README.md +477 -0
  5. data/bin/puma +10 -0
  6. data/bin/puma-wild +25 -0
  7. data/bin/pumactl +12 -0
  8. data/docs/architecture.md +74 -0
  9. data/docs/compile_options.md +55 -0
  10. data/docs/deployment.md +102 -0
  11. data/docs/fork_worker.md +41 -0
  12. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  13. data/docs/images/puma-connection-flow.png +0 -0
  14. data/docs/images/puma-general-arch.png +0 -0
  15. data/docs/java_options.md +54 -0
  16. data/docs/jungle/README.md +9 -0
  17. data/docs/jungle/rc.d/README.md +74 -0
  18. data/docs/jungle/rc.d/puma +61 -0
  19. data/docs/jungle/rc.d/puma.conf +10 -0
  20. data/docs/kubernetes.md +80 -0
  21. data/docs/nginx.md +80 -0
  22. data/docs/plugins.md +42 -0
  23. data/docs/rails_dev_mode.md +28 -0
  24. data/docs/restart.md +65 -0
  25. data/docs/signals.md +98 -0
  26. data/docs/stats.md +148 -0
  27. data/docs/systemd.md +253 -0
  28. data/docs/testing_benchmarks_local_files.md +150 -0
  29. data/docs/testing_test_rackup_ci_files.md +36 -0
  30. data/ext/puma_http11/PumaHttp11Service.java +17 -0
  31. data/ext/puma_http11/ext_help.h +15 -0
  32. data/ext/puma_http11/extconf.rb +65 -0
  33. data/ext/puma_http11/http11_parser.c +1057 -0
  34. data/ext/puma_http11/http11_parser.h +65 -0
  35. data/ext/puma_http11/http11_parser.java.rl +145 -0
  36. data/ext/puma_http11/http11_parser.rl +149 -0
  37. data/ext/puma_http11/http11_parser_common.rl +54 -0
  38. data/ext/puma_http11/mini_ssl.c +852 -0
  39. data/ext/puma_http11/no_ssl/PumaHttp11Service.java +15 -0
  40. data/ext/puma_http11/org/jruby/puma/Http11.java +257 -0
  41. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +455 -0
  42. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +509 -0
  43. data/ext/puma_http11/puma_http11.c +507 -0
  44. data/lib/puma/app/status.rb +96 -0
  45. data/lib/puma/binder.rb +511 -0
  46. data/lib/puma/cli.rb +245 -0
  47. data/lib/puma/client.rb +720 -0
  48. data/lib/puma/cluster/worker.rb +182 -0
  49. data/lib/puma/cluster/worker_handle.rb +127 -0
  50. data/lib/puma/cluster.rb +635 -0
  51. data/lib/puma/cluster_accept_loop_delay.rb +91 -0
  52. data/lib/puma/commonlogger.rb +115 -0
  53. data/lib/puma/configuration.rb +452 -0
  54. data/lib/puma/const.rb +307 -0
  55. data/lib/puma/control_cli.rb +320 -0
  56. data/lib/puma/detect.rb +47 -0
  57. data/lib/puma/dsl.rb +1480 -0
  58. data/lib/puma/error_logger.rb +115 -0
  59. data/lib/puma/events.rb +72 -0
  60. data/lib/puma/io_buffer.rb +50 -0
  61. data/lib/puma/jruby_restart.rb +11 -0
  62. data/lib/puma/json_serialization.rb +96 -0
  63. data/lib/puma/launcher/bundle_pruner.rb +104 -0
  64. data/lib/puma/launcher.rb +496 -0
  65. data/lib/puma/log_writer.rb +147 -0
  66. data/lib/puma/minissl/context_builder.rb +96 -0
  67. data/lib/puma/minissl.rb +463 -0
  68. data/lib/puma/null_io.rb +101 -0
  69. data/lib/puma/plugin/systemd.rb +90 -0
  70. data/lib/puma/plugin/tmp_restart.rb +36 -0
  71. data/lib/puma/plugin.rb +111 -0
  72. data/lib/puma/rack/builder.rb +297 -0
  73. data/lib/puma/rack/urlmap.rb +93 -0
  74. data/lib/puma/rack_default.rb +24 -0
  75. data/lib/puma/reactor.rb +140 -0
  76. data/lib/puma/request.rb +701 -0
  77. data/lib/puma/runner.rb +211 -0
  78. data/lib/puma/sd_notify.rb +146 -0
  79. data/lib/puma/server.rb +734 -0
  80. data/lib/puma/single.rb +72 -0
  81. data/lib/puma/state_file.rb +69 -0
  82. data/lib/puma/thread_pool.rb +402 -0
  83. data/lib/puma/util.rb +134 -0
  84. data/lib/puma.rb +93 -0
  85. data/lib/rack/handler/puma.rb +144 -0
  86. data/tools/Dockerfile +18 -0
  87. data/tools/trickletest.rb +44 -0
  88. metadata +152 -0
data/lib/puma.rb ADDED
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Standard libraries
4
+ require 'socket'
5
+ require 'tempfile'
6
+ require 'uri'
7
+ require 'stringio'
8
+
9
+ require 'thread'
10
+
11
+ # use require, see https://github.com/puma/puma/pull/2381
12
+ ruby_version = /(\d+\.\d+)/.match(::RUBY_VERSION)
13
+ begin
14
+ require "puma/#{ruby_version}/puma_http1"
15
+ rescue LoadError
16
+ require 'puma/puma_http11'
17
+ end
18
+
19
+ require_relative 'puma/detect'
20
+ require_relative 'puma/json_serialization'
21
+
22
+ module Puma
23
+ # when Puma is loaded via `Puma::CLI`, all files are loaded via
24
+ # `require_relative`. The below are for non-standard loading
25
+ autoload :Const, "#{__dir__}/puma/const"
26
+ autoload :Server, "#{__dir__}/puma/server"
27
+ autoload :Launcher, "#{__dir__}/puma/launcher"
28
+ autoload :LogWriter, "#{__dir__}/puma/log_writer"
29
+
30
+ # at present, MiniSSL::Engine is only defined in extension code (puma_http11),
31
+ # not in minissl.rb
32
+ HAS_SSL = const_defined?(:MiniSSL, false) && MiniSSL.const_defined?(:Engine, false)
33
+
34
+ HAS_UNIX_SOCKET = Object.const_defined?(:UNIXSocket) && !IS_WINDOWS
35
+
36
+ if HAS_SSL
37
+ require_relative 'puma/minissl'
38
+ else
39
+ module MiniSSL
40
+ # this class is defined so that it exists when Puma is compiled
41
+ # without ssl support, as Server and Reactor use it in rescue statements.
42
+ class SSLError < StandardError ; end
43
+ end
44
+ end
45
+
46
+ def self.ssl?
47
+ HAS_SSL
48
+ end
49
+
50
+ def self.abstract_unix_socket?
51
+ @abstract_unix ||=
52
+ if HAS_UNIX_SOCKET
53
+ begin
54
+ ::UNIXServer.new("\0puma.temp.unix").close
55
+ true
56
+ rescue ArgumentError # darwin
57
+ false
58
+ end
59
+ else
60
+ false
61
+ end
62
+ end
63
+
64
+ # @!attribute [rw] stats_object=
65
+ def self.stats_object=(val)
66
+ @get_stats = val
67
+ end
68
+
69
+ # @!attribute [rw] stats_object
70
+ def self.stats
71
+ Puma::JSONSerialization.generate @get_stats.stats
72
+ end
73
+
74
+ # @!attribute [r] stats_hash
75
+ # @version 5.0.0
76
+ def self.stats_hash
77
+ @get_stats.stats
78
+ end
79
+
80
+ def self.set_thread_name(name)
81
+ Thread.current.name = "puma #{name}"
82
+ end
83
+
84
+ # Shows deprecated warning for renamed methods.
85
+ # @example
86
+ # Puma.deprecate_method_change :on_booted, __callee__, __method__
87
+ #
88
+ def self.deprecate_method_change(method_old, method_caller, method_new)
89
+ if method_old == method_caller
90
+ warn "Use '#{method_new}', '#{method_caller}' is deprecated and will be removed in v8"
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,144 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Puma
4
+
5
+ # This module is used as an 'include' file in code at bottom of file. It loads
6
+ # into either `Rackup::Handler::Puma` or `Rack::Handler::Puma`.
7
+
8
+ module RackHandler
9
+ DEFAULT_OPTIONS = {
10
+ :Verbose => false,
11
+ :Silent => false
12
+ }
13
+
14
+ def config(app, options = {})
15
+ require_relative '../../puma'
16
+ require_relative '../../puma/configuration'
17
+ require_relative '../../puma/log_writer'
18
+ require_relative '../../puma/launcher'
19
+
20
+ default_options = DEFAULT_OPTIONS.dup
21
+
22
+ # Libraries pass in values such as :Port and there is no way to determine
23
+ # if it is a default provided by the library or a special value provided
24
+ # by the user. A special key `user_supplied_options` can be passed. This
25
+ # contains an array of all explicitly defined user options. We then
26
+ # know that all other values are defaults
27
+ if user_supplied_options = options.delete(:user_supplied_options)
28
+ (options.keys - user_supplied_options).each do |k|
29
+ default_options[k] = options.delete(k)
30
+ end
31
+ end
32
+
33
+ @events = options[:events] || ::Puma::Events.new
34
+
35
+ conf = ::Puma::Configuration.new(options, default_options.merge({ events: @events })) do |user_config, file_config, default_config|
36
+ if options.delete(:Verbose)
37
+ begin
38
+ require 'rack/commonlogger' # Rack 1.x
39
+ rescue LoadError
40
+ require 'rack/common_logger' # Rack 2 and later
41
+ end
42
+ app = ::Rack::CommonLogger.new(app, STDOUT)
43
+ end
44
+
45
+ if options[:environment]
46
+ user_config.environment options[:environment]
47
+ end
48
+
49
+ if options[:Threads]
50
+ min, max = options.delete(:Threads).split(':', 2)
51
+ user_config.threads min, max
52
+ end
53
+
54
+ if options[:Host] || options[:Port]
55
+ host = options[:Host] || default_options[:Host]
56
+ port = options[:Port] || default_options[:Port]
57
+ self.set_host_port_to_config(host, port, user_config)
58
+ end
59
+
60
+ if default_options[:Host]
61
+ file_config.set_default_host(default_options[:Host])
62
+ end
63
+ self.set_host_port_to_config(default_options[:Host], default_options[:Port], default_config)
64
+
65
+ user_config.app app
66
+ end
67
+ conf
68
+ end
69
+
70
+ def run(app, **options)
71
+ conf = self.config(app, options)
72
+
73
+ log_writer = options.delete(:Silent) ? ::Puma::LogWriter.strings : ::Puma::LogWriter.stdio
74
+
75
+ launcher = ::Puma::Launcher.new(conf, log_writer: log_writer, events: @events)
76
+
77
+ yield launcher if block_given?
78
+ begin
79
+ launcher.run
80
+ rescue Interrupt
81
+ puts "* Gracefully stopping, waiting for requests to finish"
82
+ launcher.stop
83
+ puts "* Goodbye!"
84
+ end
85
+ end
86
+
87
+ def valid_options
88
+ {
89
+ "Host=HOST" => "Hostname to listen on (default: localhost)",
90
+ "Port=PORT" => "Port to listen on (default: 8080)",
91
+ "Threads=MIN:MAX" => "min:max threads to use (default 0:16)",
92
+ "Verbose" => "Don't report each request (default: false)"
93
+ }
94
+ end
95
+
96
+ def set_host_port_to_config(host, port, config)
97
+ config.clear_binds! if host || port
98
+
99
+ if host&.start_with? '.', '/', '@'
100
+ config.bind "unix://#{host}"
101
+ elsif host&.start_with? 'ssl://'
102
+ uri = URI.parse(host)
103
+ uri.port ||= port || ::Puma::Configuration::DEFAULTS[:tcp_port]
104
+ config.bind uri.to_s
105
+ else
106
+
107
+ if host
108
+ port ||= ::Puma::Configuration::DEFAULTS[:tcp_port]
109
+ end
110
+
111
+ if port
112
+ host ||= ::Puma::Configuration::DEFAULTS[:tcp_host]
113
+ config.port port, host
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+
120
+ # rackup was removed in Rack 3, it is now a separate gem
121
+ if Object.const_defined?(:Rackup) && ::Rackup.const_defined?(:Handler)
122
+ module Rackup
123
+ module Handler
124
+ module Puma
125
+ class << self
126
+ include ::Puma::RackHandler
127
+ end
128
+ end
129
+ register :puma, Puma
130
+ end
131
+ end
132
+ else
133
+ do_register = Object.const_defined?(:Rack) && ::Rack.release < '3'
134
+ module Rack
135
+ module Handler
136
+ module Puma
137
+ class << self
138
+ include ::Puma::RackHandler
139
+ end
140
+ end
141
+ end
142
+ end
143
+ ::Rack::Handler.register(:puma, ::Rack::Handler::Puma) if do_register
144
+ end
data/tools/Dockerfile ADDED
@@ -0,0 +1,18 @@
1
+ # Use this Dockerfile to create minimal reproductions of issues
2
+
3
+ FROM ruby:3.2
4
+
5
+ RUN apt-get update && apt-get install -y ragel
6
+
7
+ # throw errors if Gemfile has been modified since Gemfile.lock
8
+ RUN bundle config --global frozen 1
9
+
10
+ WORKDIR /usr/src/app
11
+
12
+ COPY . .
13
+
14
+ RUN bundle install
15
+ RUN bundle exec rake compile
16
+
17
+ EXPOSE 9292
18
+ CMD ["bundle", "exec", "bin/puma", "test/rackup/hello.ru"]
@@ -0,0 +1,44 @@
1
+ require 'socket'
2
+ require 'stringio'
3
+
4
+ def do_test(st, chunk)
5
+ s = TCPSocket.new('127.0.0.1',ARGV[0].to_i);
6
+ req = StringIO.new(st)
7
+ nout = 0
8
+ randstop = rand(st.length / 10)
9
+ STDERR.puts "stopping after: #{randstop}"
10
+
11
+ begin
12
+ while data = req.read(chunk)
13
+ nout += s.write(data)
14
+ s.flush
15
+ sleep 0.1
16
+ if nout > randstop
17
+ STDERR.puts "BANG! after #{nout} bytes."
18
+ break
19
+ end
20
+ end
21
+ rescue Object => e
22
+ STDERR.puts "ERROR: #{e}"
23
+ ensure
24
+ s.close
25
+ end
26
+ end
27
+
28
+ content = "-" * (1024 * 240)
29
+ st = "GET / HTTP/1.1\r\nHost: www.zedshaw.com\r\nContent-Type: text/plain\r\nContent-Length: #{content.length}\r\n\r\n#{content}"
30
+
31
+ puts "length: #{content.length}"
32
+
33
+ threads = []
34
+ ARGV[1].to_i.times do
35
+ t = Thread.new do
36
+ size = 100
37
+ puts ">>>> #{size} sized chunks"
38
+ do_test(st, size)
39
+ end
40
+
41
+ threads << t
42
+ end
43
+
44
+ threads.each {|t| t.join}
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ed-precompiled_puma
3
+ version: !ruby/object:Gem::Version
4
+ version: 7.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Evan Phoenix
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: nio4r
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '2.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '2.0'
26
+ description: |
27
+ Puma is a simple, fast, multi-threaded, and highly parallel HTTP 1.1 server
28
+ for Ruby/Rack applications. Puma is intended for use in both development and
29
+ production environments. It's great for highly parallel Ruby implementations such as
30
+ JRuby and TruffleRuby as well as as providing process worker support to support CRuby well.
31
+ email:
32
+ - evan@phx.io
33
+ executables:
34
+ - puma
35
+ - pumactl
36
+ extensions:
37
+ - ext/puma_http11/extconf.rb
38
+ extra_rdoc_files: []
39
+ files:
40
+ - History.md
41
+ - LICENSE
42
+ - README.md
43
+ - bin/puma
44
+ - bin/puma-wild
45
+ - bin/pumactl
46
+ - docs/architecture.md
47
+ - docs/compile_options.md
48
+ - docs/deployment.md
49
+ - docs/fork_worker.md
50
+ - docs/images/puma-connection-flow-no-reactor.png
51
+ - docs/images/puma-connection-flow.png
52
+ - docs/images/puma-general-arch.png
53
+ - docs/java_options.md
54
+ - docs/jungle/README.md
55
+ - docs/jungle/rc.d/README.md
56
+ - docs/jungle/rc.d/puma
57
+ - docs/jungle/rc.d/puma.conf
58
+ - docs/kubernetes.md
59
+ - docs/nginx.md
60
+ - docs/plugins.md
61
+ - docs/rails_dev_mode.md
62
+ - docs/restart.md
63
+ - docs/signals.md
64
+ - docs/stats.md
65
+ - docs/systemd.md
66
+ - docs/testing_benchmarks_local_files.md
67
+ - docs/testing_test_rackup_ci_files.md
68
+ - ext/puma_http11/PumaHttp11Service.java
69
+ - ext/puma_http11/ext_help.h
70
+ - ext/puma_http11/extconf.rb
71
+ - ext/puma_http11/http11_parser.c
72
+ - ext/puma_http11/http11_parser.h
73
+ - ext/puma_http11/http11_parser.java.rl
74
+ - ext/puma_http11/http11_parser.rl
75
+ - ext/puma_http11/http11_parser_common.rl
76
+ - ext/puma_http11/mini_ssl.c
77
+ - ext/puma_http11/no_ssl/PumaHttp11Service.java
78
+ - ext/puma_http11/org/jruby/puma/Http11.java
79
+ - ext/puma_http11/org/jruby/puma/Http11Parser.java
80
+ - ext/puma_http11/org/jruby/puma/MiniSSL.java
81
+ - ext/puma_http11/puma_http11.c
82
+ - lib/puma.rb
83
+ - lib/puma/app/status.rb
84
+ - lib/puma/binder.rb
85
+ - lib/puma/cli.rb
86
+ - lib/puma/client.rb
87
+ - lib/puma/cluster.rb
88
+ - lib/puma/cluster/worker.rb
89
+ - lib/puma/cluster/worker_handle.rb
90
+ - lib/puma/cluster_accept_loop_delay.rb
91
+ - lib/puma/commonlogger.rb
92
+ - lib/puma/configuration.rb
93
+ - lib/puma/const.rb
94
+ - lib/puma/control_cli.rb
95
+ - lib/puma/detect.rb
96
+ - lib/puma/dsl.rb
97
+ - lib/puma/error_logger.rb
98
+ - lib/puma/events.rb
99
+ - lib/puma/io_buffer.rb
100
+ - lib/puma/jruby_restart.rb
101
+ - lib/puma/json_serialization.rb
102
+ - lib/puma/launcher.rb
103
+ - lib/puma/launcher/bundle_pruner.rb
104
+ - lib/puma/log_writer.rb
105
+ - lib/puma/minissl.rb
106
+ - lib/puma/minissl/context_builder.rb
107
+ - lib/puma/null_io.rb
108
+ - lib/puma/plugin.rb
109
+ - lib/puma/plugin/systemd.rb
110
+ - lib/puma/plugin/tmp_restart.rb
111
+ - lib/puma/rack/builder.rb
112
+ - lib/puma/rack/urlmap.rb
113
+ - lib/puma/rack_default.rb
114
+ - lib/puma/reactor.rb
115
+ - lib/puma/request.rb
116
+ - lib/puma/runner.rb
117
+ - lib/puma/sd_notify.rb
118
+ - lib/puma/server.rb
119
+ - lib/puma/single.rb
120
+ - lib/puma/state_file.rb
121
+ - lib/puma/thread_pool.rb
122
+ - lib/puma/util.rb
123
+ - lib/rack/handler/puma.rb
124
+ - tools/Dockerfile
125
+ - tools/trickletest.rb
126
+ homepage: https://puma.io
127
+ licenses:
128
+ - BSD-3-Clause
129
+ metadata:
130
+ bug_tracker_uri: https://github.com/puma/puma/issues
131
+ changelog_uri: https://github.com/puma/puma/blob/master/History.md
132
+ homepage_uri: https://puma.io
133
+ source_code_uri: https://github.com/puma/puma
134
+ rubygems_mfa_required: 'true'
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '3.0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubygems_version: 3.6.7
150
+ specification_version: 4
151
+ summary: A Ruby/Rack web server built for parallelism.
152
+ test_files: []