Module: Puma
- Defined in:
- lib/puma.rb,
lib/puma/cli.rb,
lib/puma/dsl.rb,
lib/puma/util.rb,
lib/puma/const.rb,
lib/puma/binder.rb,
lib/puma/client.rb,
lib/puma/detect.rb,
lib/puma/events.rb,
lib/puma/plugin.rb,
lib/puma/runner.rb,
lib/puma/server.rb,
lib/puma/single.rb,
lib/puma/cluster.rb,
lib/puma/minissl.rb,
lib/puma/null_io.rb,
lib/puma/reactor.rb,
lib/puma/request.rb,
lib/puma/launcher.rb,
lib/puma/io_buffer.rb,
lib/puma/sd_notify.rb,
lib/puma/app/status.rb,
lib/puma/log_writer.rb,
lib/puma/state_file.rb,
lib/puma/control_cli.rb,
lib/puma/thread_pool.rb,
lib/puma/commonlogger.rb,
lib/puma/error_logger.rb,
lib/puma/rack/builder.rb,
lib/rack/handler/puma.rb,
lib/puma/configuration.rb,
lib/puma/jruby_restart.rb,
lib/puma/cluster/worker.rb,
lib/puma/json_serialization.rb,
lib/puma/cluster/worker_handle.rb,
lib/puma/launcher/bundle_pruner.rb,
lib/puma/minissl/context_builder.rb,
lib/puma/cluster_accept_loop_delay.rb,
ext/puma_http11/mini_ssl.c,
ext/puma_http11/puma_http11.c
Defined Under Namespace
Modules: App, Const, JRubyRestart, JSONSerialization, MiniSSL, Rack, RackHandler, Request, SdNotify, Util
Classes: Binder, CLI, Client, Cluster, ClusterAcceptLoopDelay, CommonLogger, Configuration, ConnectionError, ControlCLI, DSL, ErrorLogger, Events, HttpParser, HttpParserError, HttpParserError501, IOBuffer, Launcher, LogWriter, NullIO, Plugin, PluginLoader, PluginRegistry, Reactor, Runner, Server, Single, StateFile, ThreadPool, UnknownPlugin, UnsupportedBackend, UnsupportedOption, UserFileDefaultOptions
Constant Summary
collapse
- HAS_SSL =
at present, MiniSSL::Engine is only defined in extension code (puma_http11), not in minissl.rb
const_defined?(:MiniSSL, false) && MiniSSL.const_defined?(:Engine, false)
- HAS_UNIX_SOCKET =
Object.const_defined?(:UNIXSocket) && !IS_WINDOWS
- HTTP_STATUS_CODES =
{
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
103 => 'Early Hints',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
207 => 'Multi-Status',
208 => 'Already Reported',
226 => 'IM Used',
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
307 => 'Temporary Redirect',
308 => 'Permanent Redirect',
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Content Too Large',
414 => 'URI Too Long',
415 => 'Unsupported Media Type',
416 => 'Range Not Satisfiable',
417 => 'Expectation Failed',
421 => 'Misdirected Request',
422 => 'Unprocessable Content',
423 => 'Locked',
424 => 'Failed Dependency',
425 => 'Too Early',
426 => 'Upgrade Required',
428 => 'Precondition Required',
429 => 'Too Many Requests',
431 => 'Request Header Fields Too Large',
451 => 'Unavailable For Legal Reasons',
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
506 => 'Variant Also Negotiates',
507 => 'Insufficient Storage',
508 => 'Loop Detected',
510 => 'Not Extended (OBSOLETED)',
511 => 'Network Authentication Required'
}.freeze
- STATUS_WITH_NO_ENTITY_BODY =
For some HTTP status codes the client only expects headers.
{
204 => true,
205 => true,
304 => true
}.freeze
- HAS_FORK =
::Process.respond_to? :fork
- HAS_NATIVE_IO_WAIT =
::IO.public_instance_methods(false).include? :wait_readable
- IS_JRUBY =
Object.const_defined? :JRUBY_VERSION
- IS_OSX =
RUBY_DESCRIPTION.include? 'darwin'
- IS_WINDOWS =
RUBY_DESCRIPTION.match?(/mswin|ming|cygwin/)
- IS_LINUX =
!(IS_OSX || IS_WINDOWS)
- IS_ARM =
RUBY_PLATFORM.include? 'aarch64'
- IS_MRI =
RUBY_ENGINE == 'ruby'
- Plugins =
PluginRegistry.new
Class Attribute Summary collapse
-
.cli_config ⇒ Object
The CLI exports a Puma::Configuration instance here to allow apps to pick it up.
Instance Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.cli_config ⇒ Object
The CLI exports a Puma::Configuration instance here to allow apps to pick it up. An app must load this object conditionally because it is not set if the app is launched via any mechanism other than the CLI class.
18
19
20
|
# File 'lib/puma/cli.rb', line 18
def cli_config
@cli_config
end
|
Instance Attribute Details
#puma_server ⇒ Object
Add ‘Thread#puma_server` and `Thread#puma_server=`
10
11
12
|
# File 'lib/puma/thread_pool.rb', line 10
def puma_server
@puma_server
end
|
#stats_hash ⇒ Object
71
72
73
|
# File 'lib/puma.rb', line 71
def self.stats_hash
@get_stats.stats
end
|
#stats_object ⇒ Object
65
66
67
|
# File 'lib/puma.rb', line 65
def self.stats
Puma::JSONSerialization.generate @get_stats.stats
end
|
Class Method Details
.abstract_unix_socket? ⇒ Boolean
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/puma.rb', line 45
def self.abstract_unix_socket?
@abstract_unix ||=
if HAS_UNIX_SOCKET
begin
::UNIXServer.new("\0puma.temp.unix").close
true
rescue ArgumentError
false
end
else
false
end
end
|
.deprecate_method_change(method_old, method_caller, method_new) ⇒ Object
Shows deprecated warning for renamed methods.
83
84
85
86
87
|
# File 'lib/puma.rb', line 83
def self.deprecate_method_change(method_old, method_caller, method_new)
if method_old == method_caller
warn "Use '#{method_new}', '#{method_caller}' is deprecated and will be removed in v8"
end
end
|
.forkable? ⇒ Boolean
44
45
46
|
# File 'lib/puma/detect.rb', line 44
def self.forkable?
HAS_FORK
end
|
.jruby? ⇒ Boolean
26
27
28
|
# File 'lib/puma/detect.rb', line 26
def self.jruby?
IS_JRUBY
end
|
.mri? ⇒ Boolean
39
40
41
|
# File 'lib/puma/detect.rb', line 39
def self.mri?
IS_MRI
end
|
.osx? ⇒ Boolean
30
31
32
|
# File 'lib/puma/detect.rb', line 30
def self.osx?
IS_OSX
end
|
.set_thread_name(name) ⇒ Object
75
76
77
|
# File 'lib/puma.rb', line 75
def self.set_thread_name(name)
Thread.current.name = "puma #{name}"
end
|
.ssl? ⇒ Boolean
41
42
43
|
# File 'lib/puma.rb', line 41
def self.ssl?
HAS_SSL
end
|
.stats ⇒ Object
65
66
67
|
# File 'lib/puma.rb', line 65
def self.stats
Puma::JSONSerialization.generate @get_stats.stats
end
|
.stats_hash ⇒ Object
71
72
73
|
# File 'lib/puma.rb', line 71
def self.stats_hash
@get_stats.stats
end
|
.stats_object=(val) ⇒ Object
60
61
62
|
# File 'lib/puma.rb', line 60
def self.stats_object=(val)
@get_stats = val
end
|
.windows? ⇒ Boolean
34
35
36
|
# File 'lib/puma/detect.rb', line 34
def self.windows?
IS_WINDOWS
end
|