repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_skip_sigusr2.rb | test/test_skip_sigusr2.rb | # frozen_string_literal: true
require_relative "helper"
require_relative "helpers/integration"
require "puma/plugin"
class TestSkipSigusr2 < TestIntegration
def setup
skip_unless_signal_exist? :TERM
skip_unless_signal_exist? :USR2
super
end
def teardown
super unless skipped?
end
def tes... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_thread_pool.rb | test/test_thread_pool.rb | # frozen_string_literal: true
require_relative "helper"
require "puma/thread_pool"
class TestThreadPool < PumaTest
parallelize_me!
def teardown
@pool.shutdown(1) if defined?(@pool)
end
def new_pool(min, max, pool_shutdown_grace_time: nil, &block)
block = proc { } unless block
options = {
... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_integration_ssl_session.rb | test/test_integration_ssl_session.rb | # frozen_string_literal: true
require_relative 'helper'
require_relative 'helpers/integration'
# These tests are used to verify that Puma works with SSL sockets. Only
# integration tests isolate the server from the test environment, so there
# should be a few SSL tests.
#
# For instance, since other tests make use o... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_request_single.rb | test/test_request_single.rb | # frozen_string_literal: true
require_relative "helper"
require 'puma/client'
require 'puma/const'
require 'puma/puma_http11'
# this file tests both valid and invalid requests using only `Puma::Client'.
# It cannot test behavior with multiple requests, for that, see
# `test_request_invalid_mulitple.rb`
class TestR... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_state_file.rb | test/test_state_file.rb | # frozen_string_literal: true
require_relative "helper"
require_relative "helpers/tmp_path"
require 'puma/state_file'
class TestStateFile < PumaTest
include TmpPath
def test_load_empty_value_as_nil
state_path = tmp_path('.state')
File.write state_path, <<-STATE
---
pid: 123456
control_url:
control_auth_... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_bundle_pruner.rb | test/test_bundle_pruner.rb | # frozen_string_literal: true
require_relative 'helper'
require 'puma/events'
class TestBundlePruner < PumaTest
PUMA_VERS = "puma-#{Puma::Const::PUMA_VERSION}"
def test_paths_to_require_after_prune_is_correctly_built_for_no_extra_deps
skip_if :no_bundler
dirs = bundle_pruner.send(:paths_to_require_aft... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_plugin_systemd_jruby.rb | test/test_plugin_systemd_jruby.rb | # frozen_string_literal: true
require_relative "helper"
require_relative "helpers/integration"
require "puma/plugin"
class TestPluginSystemdJruby < TestIntegration
def setup
skip_unless :linux
skip_unless :jruby
super
end
def teardown
super unless skipped?
end
def test_systemd_plugin_no... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_binder.rb | test/test_binder.rb | # frozen_string_literal: true
require_relative "helper"
require_relative "helpers/ssl" if ::Puma::HAS_SSL
require_relative "helpers/tmp_path"
require "puma/binder"
require "puma/events"
require "puma/configuration"
class TestBinderBase < PumaTest
include SSLHelper if ::Puma::HAS_SSL
include TmpPath
def setup
... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_http11.rb | test/test_http11.rb | # frozen_string_literal: true
# Copyright (c) 2011 Evan Phoenix
# Copyright (c) 2005 Zed A. Shaw
require_relative "helper"
require_relative "helpers/integration"
require "digest"
require "puma/puma_http11"
class Http11ParserTest < TestIntegration
parallelize_me! unless ::Puma::IS_JRUBY && RUBY_DESCRIPTION.includ... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_puma_server_ssl.rb | test/test_puma_server_ssl.rb | # frozen_string_literal: true
# Nothing in this file runs if Puma isn't compiled with ssl support
#
# helper is required first since it loads Puma, which needs to be
# loaded so HAS_SSL is defined
require_relative "helper"
if ::Puma::HAS_SSL
require "puma/minissl"
require_relative "helpers/test_puma/puma_socket"
... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_rack_server.rb | test/test_rack_server.rb | # frozen_string_literal: true
require_relative "helper"
require "net/http"
# don't load Rack, as it autoloads everything
begin
require "rack/body_proxy"
require "rack/lint"
require "rack/version"
require "rack/common_logger"
rescue LoadError # Rack 1.6
require "rack"
end
# Rack::Chunked is loaded by Rack v2... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_persistent.rb | test/test_persistent.rb | # frozen_string_literal: true
require_relative "helper"
require_relative "helpers/test_puma/puma_socket"
class TestPersistent < PumaTest
parallelize_me!
include ::TestPuma::PumaSocket
HOST = "127.0.0.1"
def setup
@body = ["Hello"]
@valid_request = "GET / HTTP/1.1\r\nHost: test.com\r\nContent-Type... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/test_plugin_systemd.rb | test/test_plugin_systemd.rb | # frozen_string_literal: true
require_relative "helper"
require_relative "helpers/integration"
class TestPluginSystemd < TestIntegration
parallelize_me! if ::Puma::IS_MRI
THREAD_LOG = TRUFFLE ? "{ 0/16 threads, 16 available, 0 backlog }" :
"{ 0/5 threads, 5 available, 0 backlog }"
def setup
skip_unles... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/minitest/verbose.rb | test/minitest/verbose.rb | require "minitest"
require_relative "verbose_progress_plugin"
Minitest.load_plugins
Minitest.extensions << 'verbose_progress' unless Minitest.extensions.include?('verbose_progress')
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/minitest/verbose_progress_plugin.rb | test/minitest/verbose_progress_plugin.rb | module Minitest
# Adds minimal support for parallel tests to the default verbose progress reporter.
def self.plugin_verbose_progress_init(options)
if options[:verbose]
self.reporter.reporters.
delete_if {|r| r.is_a?(ProgressReporter)}.
push(VerboseProgressReporter.new(options[:io], options... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/helpers/ssl.rb | test/helpers/ssl.rb | # frozen_string_literal: true
module SSLHelper
def ssl_query
@ssl_query ||= if Puma.jruby?
@keystore = File.expand_path "../../examples/puma/keystore.jks", __dir__
@ssl_cipher_list = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
"keystore=#{@keystore}&keystore-pass=jr... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/helpers/test_puma.rb | test/helpers/test_puma.rb | # frozen_string_literal: true
require 'socket'
module TestPuma
RESP_SPLIT = "\r\n\r\n"
LINE_SPLIT = "\r\n"
RE_HOST_TO_IP = /\A\[|\]\z/o
HOST4 = begin
t = Socket.ip_address_list.select(&:ipv4_loopback?).map(&:ip_address)
.uniq.sort_by(&:length)
# puts "IPv4 Loopback #{t}"
str = t.include?(... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/helpers/integration.rb | test/helpers/integration.rb | # frozen_string_literal: true
require "puma/control_cli"
require "json"
require "open3"
require_relative 'tmp_path'
# Only single mode tests go here. Cluster and pumactl tests
# have their own files, use those instead
class TestIntegration < PumaTest
include TmpPath
HOST = "127.0.0.1"
TOKEN = "xxyyzz"
RESP_R... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/helpers/tmp_path.rb | test/helpers/tmp_path.rb | # frozen_string_literal: true
module TmpPath
def clean_tmp_paths
while path = tmp_paths.pop
delete_tmp_path(path)
end
end
private
# With some macOS configurations, the following error may be raised when
# creating a UNIXSocket:
#
# too long unix socket path (106 bytes given but 104 bytes ... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/helpers/apps.rb | test/helpers/apps.rb | # frozen_string_literal: true
module TestApps
# call with "GET /sleep<d> HTTP/1.1\r\n\r\n", where is the number of
# seconds to sleep
# same as rackup/sleep.ru
SLEEP = -> (env) do
dly = (env['REQUEST_PATH'][/\/sleep(\d+)/,1] || '0').to_i
sleep dly
[200, {"Content-Type" => "text/plain"}, ["Slept #{... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/helpers/test_puma/puma_socket.rb | test/helpers/test_puma/puma_socket.rb | # frozen_string_literal: true
require 'socket'
require_relative '../test_puma'
require_relative 'response'
module TestPuma
# @!macro [new] req
# @param req [String, GET_11] request path
# @!macro [new] skt
# @param host [String] tcp/ssl host
# @param port [Integer/String] tcp/ssl port
# @param p... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/helpers/test_puma/assertions.rb | test/helpers/test_puma/assertions.rb | # frozen_string_literal: true
module TestPuma
module Assertions
# iso8601 2022-12-14T00:05:49Z
RE_8601 = /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z\z/
def assert_start_with(obj, str, msg = nil)
msg = message(msg) {
"Expected\n#{obj}\nto start with #{str}"
}
assert_respond_to obj,... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/helpers/test_puma/response.rb | test/helpers/test_puma/response.rb | # frozen_string_literal: true
module TestPuma
# A subclass of String, allows processing the response returned by
# `PumaSocket#send_http_read_response` and the `read_response` method added
# to native socket instances (created with `PumaSocket#new_socket` and
# `PumaSocket#send_http`.
#
class Response < S... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/bundle_preservation_test/version1/config/puma.rb | test/bundle_preservation_test/version1/config/puma.rb | directory File.expand_path("../../current", __dir__)
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/bundle_preservation_test/version2/config/puma.rb | test/bundle_preservation_test/version2/config/puma.rb | directory File.expand_path("../../current", __dir__)
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/t4_conf.rb | test/config/t4_conf.rb | stdout_redirect "t4-stdout"
pidfile "t4-pid"
class CustomLogger
def initialize(output=STDOUT)
@output = output
end
def write(msg)
@output.puts 'Custom logging: ' + msg
@output.flush
end
end
log_requests
custom_logger CustomLogger.new(STDOUT)
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/state_file_testing_config.rb | test/config/state_file_testing_config.rb | pidfile "t3-pid"
workers 3
before_worker_boot do |index|
File.open("t3-worker-#{index}-pid", "w") { |f| f.puts Process.pid }
end
before_fork { 1 }
before_worker_shutdown { 1 }
before_worker_boot { 1 }
before_worker_fork { 1 }
before_restart { 1 }
after_worker_boot { 1 }
lowlevel_error_handler { 1 }
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/t1_conf.rb | test/config/t1_conf.rb | log_requests
stdout_redirect "t1-stdout"
pidfile "t1-pid"
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/prune_bundler_print_json_defined.rb | test/config/prune_bundler_print_json_defined.rb | prune_bundler true
before_fork do
puts "defined?(::JSON): #{defined?(::JSON).inspect}"
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/t2_conf.rb | test/config/t2_conf.rb | log_requests
stdout_redirect "t2-stdout"
pidfile "t2-pid"
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/ssl_config.rb | test/config/ssl_config.rb | key = File.expand_path "../../../examples/puma/puma_keypair.pem", __FILE__
cert = File.expand_path "../../../examples/puma/cert_puma.pem", __FILE__
ca = File.expand_path "../../../examples/puma/client_certs/ca.crt", __FILE__
ssl_bind "0.0.0.0", 9292, :cert => cert, :key => key, :verify_mode => "peer", :ca => ca
app ... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/workers_2.rb | test/config/workers_2.rb | workers 2
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/fork_worker.rb | test/config/fork_worker.rb | fork_worker 1_000
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/event_after_booted_and_after_stopped.rb | test/config/event_after_booted_and_after_stopped.rb | after_booted do
puts "after_booted called"
end
after_stopped do
puts "after_stopped called"
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/with_rackup_from_dsl.rb | test/config/with_rackup_from_dsl.rb | rackup "test/rackup/hello-env.ru"
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/custom_log_formatter.rb | test/config/custom_log_formatter.rb | log_formatter do |str|
"[#{Process.pid}] [#{Socket.gethostname}] #{Time.now}: #{str}"
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/max_fast_inline_infinity.rb | test/config/max_fast_inline_infinity.rb | max_keep_alive Float::INFINITY
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/prune_bundler_with_multiple_workers.rb | test/config/prune_bundler_with_multiple_workers.rb | require 'bundler/setup'
Bundler.setup
prune_bundler true
workers 2
app do |env|
[200, {}, ["embedded app"]]
end
lowlevel_error_handler do |err|
[200, {}, ["error page"]]
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/ssl_self_signed_config.rb | test/config/ssl_self_signed_config.rb | require "localhost"
ssl_bind "0.0.0.0", 9292
app do |env|
[200, {}, ["self-signed certificate app"]]
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/max_keep_alive_infinity.rb | test/config/max_keep_alive_infinity.rb | max_keep_alive Float::INFINITY
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/app.rb | test/config/app.rb | port ENV.fetch('PORT', 0)
app do |env|
[200, {}, ["embedded app"]]
end
lowlevel_error_handler do |err|
[200, {}, ["error page"]]
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/settings.rb | test/config/settings.rb | port 3000
threads 3, 5
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/ab_rs.rb | test/config/ab_rs.rb | url = ARGV.shift
count = (ARGV.shift || 1000).to_i
STDOUT.sync = true
1.upto(5) do |i|
print "#{i}: "
str = `ab -n #{count} -c #{i} #{url} 2>/dev/null`
rs = /Requests per second:\s+([\d.]+)\s/.match(str)
puts rs[1]
end
puts "Keep Alive:"
1.upto(5) do |i|
print "#{i}: "
str = `ab -n #{count} -k -c #{i} ... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/workers_0.rb | test/config/workers_0.rb | workers 0
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/suppress_exception.rb | test/config/suppress_exception.rb | raise_exception_on_sigterm false
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/with_symbol_convert.rb | test/config/with_symbol_convert.rb | io_selector_backend :ruby
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/config_with_deprecated.rb | test/config/config_with_deprecated.rb | on_booted { puts "never called" }
app do |env|
[200, {}, ["embedded app"]]
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/cli_config.rb | test/config/cli_config.rb | if Puma.cli_config._options[:workers] == 2
Puma.cli_config._options[:workers] = 4
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/process_detach_before_fork.rb | test/config/process_detach_before_fork.rb | worker_shutdown_timeout 0
before_fork do
pid = fork do
sleep 30 # This has to exceed the test timeout
end
pid_filename = File.join(Dir.tmpdir, 'process_detach_test.pid')
File.write(pid_filename, pid)
Process.detach(pid)
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/rack_url_scheme.rb | test/config/rack_url_scheme.rb | rack_url_scheme "https"
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/prune_bundler_with_deps.rb | test/config/prune_bundler_with_deps.rb | prune_bundler true
extra_runtime_dependencies ["minitest"]
before_fork do
$LOAD_PATH.each do |path|
puts "LOAD_PATH: #{path}"
end
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/event_after_booted_exit.rb | test/config/event_after_booted_exit.rb | after_booted do
pid = Process.pid
begin
Process.kill :TERM, pid
rescue Errno::ESRCH
end
begin
Process.wait2 pid
rescue Errno::ECHILD
end
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/after_shutdown_hook.rb | test/config/after_shutdown_hook.rb | workers 2
after_worker_shutdown do |worker|
STDOUT.syswrite "\nafter_worker_shutdown worker=#{worker.index} status=#{worker.process_status.to_i}"
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/cpu_spin.rb | test/config/cpu_spin.rb | # call with "GET /cpu/<d> HTTP/1.1\r\n\r\n",
# where <d> is the number of iterations
require 'benchmark'
# configure `wait_for_less_busy_workers` based on ENV, default `true`
wait_for_less_busy_worker ENV.fetch('PUMA_WAIT_FOR_LESS_BUSY_WORKERS', '0.005').to_f
app do |env|
iterations = (env['REQUEST_PATH'][/\/cpu\/... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/worker_respawn.rb | test/config/worker_respawn.rb | worker_shutdown_timeout 2
# Workers may be respawned with either :TERM or phased restart (:USR1),
# preloading is not compatible with the latter.
preload_app! false
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/prune_bundler_print_nio_defined.rb | test/config/prune_bundler_print_nio_defined.rb | prune_bundler true
before_fork do
puts "defined?(::NIO): #{defined?(::NIO).inspect}"
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/with_integer_convert.rb | test/config/with_integer_convert.rb | persistent_timeout "6"
first_data_timeout "3"
workers "2"
threads "4", "8"
worker_timeout "90"
worker_boot_timeout "120"
worker_shutdown_timeout "150"
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/t3_conf.rb | test/config/t3_conf.rb | pidfile "t3-pid"
workers 3
before_worker_boot do |index|
File.open("t3-worker-#{index}-pid", "w") { |f| f.puts Process.pid }
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/hook_data.rb | test/config/hook_data.rb | workers 2
before_worker_boot(:test) do |index, data|
data[:test] = index
end
before_worker_shutdown(:test) do |index, data|
STDOUT.syswrite "\nindex #{index} data #{data[:test]}"
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/custom_logger.rb | test/config/custom_logger.rb | class CustomLogger
def initialize(output=STDOUT)
@output = output
end
def write(msg)
@output.puts 'Custom logging: ' + msg
@output.flush
end
end
log_requests
custom_logger CustomLogger.new(STDOUT)
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/config/control_no_token.rb | test/config/control_no_token.rb | activate_control_app 'unix:///tmp/pumactl.sock', { no_token: true }
app do |env|
[200, {}, ["embedded app"]]
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/worker_gem_independence_test/old_nio4r/config/puma.rb | test/worker_gem_independence_test/old_nio4r/config/puma.rb | directory File.expand_path("../../current", __dir__)
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/worker_gem_independence_test/old_json/config/puma.rb | test/worker_gem_independence_test/old_json/config/puma.rb | directory File.expand_path("../../current", __dir__)
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/worker_gem_independence_test/new_nio4r/config/puma.rb | test/worker_gem_independence_test/new_nio4r/config/puma.rb | directory File.expand_path("../../current", __dir__)
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/worker_gem_independence_test/new_json/config/puma.rb | test/worker_gem_independence_test/new_json/config/puma.rb | directory File.expand_path("../../current", __dir__)
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/worker_gem_independence_test/old_json_with_puma_stats_after_fork/config/puma.rb | test/worker_gem_independence_test/old_json_with_puma_stats_after_fork/config/puma.rb | directory File.expand_path("../../current", __dir__)
after_worker_fork { Puma.stats }
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/test/worker_gem_independence_test/new_json_with_puma_stats_after_fork/config/puma.rb | test/worker_gem_independence_test/new_json_with_puma_stats_after_fork/config/puma.rb | directory File.expand_path("../../current", __dir__)
after_worker_fork { Puma.stats }
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/ext/puma_http11/extconf.rb | ext/puma_http11/extconf.rb | require 'mkmf'
dir_config("puma_http11")
if $mingw
append_cflags '-fstack-protector-strong -D_FORTIFY_SOURCE=2'
append_ldflags '-fstack-protector-strong -l:libssp.a'
have_library 'ssp'
end
unless ENV["PUMA_DISABLE_SSL"]
# don't use pkg_config('openssl') if '--with-openssl-dir' is used
has_openssl_dir = di... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/examples/generate_server_test.rb | examples/generate_server_test.rb | # frozen_string_literal: true
=begin
regenerates cert_puma.pem and puma_keypair.pem
dates, key length & sign_algorithm are changed
=end
require 'openssl'
module GenerateServerCerts
KEY_LEN = 2048
SIGN_ALGORITHM = OpenSSL::Digest::SHA256
FNC = 'cert_puma.pem'
FNK = 'puma_keypair.pem'
class << self
d... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/examples/generate_client_test.rb | examples/generate_client_test.rb | # frozen_string_literal: false
=begin
run code to generate all certs
certs before date will be the first of the current month
=end
require "openssl"
module GenerateClientCerts
KEY_LEN = 2048
SIGN_ALGORITHM = OpenSSL::Digest::SHA256
CA_EXTS = [
["basicConstraints","CA:TRUE",true],
["keyUsage","cRLSign... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/examples/generate_chain_test.rb | examples/generate_chain_test.rb | # frozen_string_literal: true
=begin
regenerates ca.pem, ca_keypair.pem,
subca.pem, subca_keypair.pem,
cert.pem, cert_keypair.pem
ca_chain.pem,
cert_chain.pem
certs before date will be the first of the current month
=end
require 'bundler/inline'
gemfile(true) do
sour... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/examples/puma/client_certs/run_server_with_certs.rb | examples/puma/client_certs/run_server_with_certs.rb | require "bundler/setup"
require "puma"
require "puma/detect"
require "puma/puma_http11"
require "puma/minissl"
app = proc {|env|
p env['puma.peercert']
[200, {}, [ env['puma.peercert'] ]]
}
log_writer = Puma::LogWriter.new($stdout, $stderr)
server = Puma::Server.new(app, log_writer)
context = Puma::MiniSSL::Conte... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/examples/plugins/redis_stop_puma.rb | examples/plugins/redis_stop_puma.rb | require 'puma/plugin'
require 'redis'
# How to stop Puma on Heroku
# - You can't use normal methods because the dyno is not accessible
# - There's no file system, no way to send signals
# but ...
# - You can use Redis or Memcache; any network distributed key-value
# store
# 1. Add this plugin to your 'lib' director... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma.rb | lib/puma.rb | # frozen_string_literal: true
# Standard libraries
require 'socket'
require 'tempfile'
require 'uri'
require 'stringio'
require 'thread'
# use require, see https://github.com/puma/puma/pull/2381
require 'puma/puma_http11'
require_relative 'puma/detect'
require_relative 'puma/json_serialization'
module Puma
# whe... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/events.rb | lib/puma/events.rb | # frozen_string_literal: true
module Puma
# This is an event sink used by `Puma::Server` to handle
# lifecycle events such as :after_booted, :before_restart, and :after_stopped.
# Using `Puma::DSL` it is possible to register callback hooks
# for each event type.
class Events
def initialize
@hooks... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/commonlogger.rb | lib/puma/commonlogger.rb | # frozen_string_literal: true
module Puma
# Rack::CommonLogger forwards every request to the given +app+, and
# logs a line in the
# {Apache common log format}[https://httpd.apache.org/docs/2.4/logs.html#common]
# to the +logger+.
#
# If +logger+ is nil, CommonLogger will fall back +rack.errors+, which is
... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/cluster.rb | lib/puma/cluster.rb | # frozen_string_literal: true
require_relative 'runner'
require_relative 'util'
require_relative 'plugin'
require_relative 'cluster/worker_handle'
require_relative 'cluster/worker'
module Puma
# This class is instantiated by the `Puma::Launcher` and used
# to boot and serve a Ruby application when puma "workers" ... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/rack_default.rb | lib/puma/rack_default.rb | # frozen_string_literal: true
require_relative '../rack/handler/puma'
# rackup was removed in Rack 3, it is now a separate gem
if Object.const_defined? :Rackup
module Rackup
module Handler
def self.default(options = {})
::Rackup::Handler::Puma
end
end
end
elsif Object.const_defined?(:R... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/reactor.rb | lib/puma/reactor.rb | # frozen_string_literal: true
module Puma
class UnsupportedBackend < StandardError; end
# Monitors a collection of IO objects, calling a block whenever
# any monitored object either receives data or times out, or when the Reactor shuts down.
#
# The waiting/wake up is performed with nio4r, which will use th... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/minissl.rb | lib/puma/minissl.rb | # frozen_string_literal: true
begin
require 'io/wait' unless Puma::HAS_NATIVE_IO_WAIT
rescue LoadError
end
require 'open3'
# need for Puma::MiniSSL::OPENSSL constants used in `HAS_TLS1_3`
# use require, see https://github.com/puma/puma/pull/2381
require 'puma/puma_http11'
module Puma
module MiniSSL
# Define ... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/const.rb | lib/puma/const.rb | #encoding: utf-8
# frozen_string_literal: true
module Puma
class UnsupportedOption < RuntimeError
end
# Every standard HTTP code mapped to the appropriate message. These are
# used so frequently that they are placed directly in Puma for easy
# access rather than Puma::Const itself.
# Every standard HTTP... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/null_io.rb | lib/puma/null_io.rb | # frozen_string_literal: true
module Puma
# Provides an IO-like object that always appears to contain no data.
# Used as the value for rack.input when the request has no body.
#
class NullIO
def gets
nil
end
def string
""
end
def each
end
def pos
0
end
... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/log_writer.rb | lib/puma/log_writer.rb | # frozen_string_literal: true
require_relative 'null_io'
require_relative 'error_logger'
require 'stringio'
require 'io/wait' unless Puma::HAS_NATIVE_IO_WAIT
module Puma
# Handles logging concerns for both standard messages
# (+stdout+) and errors (+stderr+).
class LogWriter
class DefaultFormatter
d... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/sd_notify.rb | lib/puma/sd_notify.rb | # frozen_string_literal: true
require "socket"
module Puma
# The MIT License
#
# Copyright (c) 2017-2022 Agis Anastasopoulos
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software ... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/plugin.rb | lib/puma/plugin.rb | # frozen_string_literal: true
module Puma
class UnknownPlugin < RuntimeError; end
class PluginLoader
def initialize
@instances = []
end
def create(name)
if cls = Plugins.find(name)
plugin = cls.new
@instances << plugin
return plugin
end
raise UnknownPl... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/control_cli.rb | lib/puma/control_cli.rb | # frozen_string_literal: true
require 'optparse'
require_relative 'const'
require_relative 'detect'
require 'uri'
require 'socket'
module Puma
class ControlCLI
# values must be string or nil
# value of `nil` means command cannot be processed via signal
# @version 5.0.3
CMD_PATH_SIG_MAP = {
'g... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/single.rb | lib/puma/single.rb | # frozen_string_literal: true
require_relative 'runner'
require_relative 'detect'
require_relative 'plugin'
module Puma
# This class is instantiated by the `Puma::Launcher` and used
# to boot and serve a Ruby application when no puma "workers" are needed
# i.e. only using "threaded" mode. For example `$ puma -t... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/dsl.rb | lib/puma/dsl.rb | # frozen_string_literal: true
require_relative 'const'
require_relative 'util'
module Puma
# The methods that are available for use inside the configuration file.
# These same methods are used in Puma cli and the rack handler
# internally.
#
# Used manually (via CLI class):
#
# config = Configuration.... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | true |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/state_file.rb | lib/puma/state_file.rb | # frozen_string_literal: true
module Puma
# Puma::Launcher uses StateFile to write a yaml file for use with Puma::ControlCLI.
#
# In previous versions of Puma, YAML was used to read/write the state file.
# Since Puma is similar to Bundler/RubyGems in that it may load before one's app
# does, minimizing the ... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/io_buffer.rb | lib/puma/io_buffer.rb | # frozen_string_literal: true
require 'stringio'
module Puma
class IOBuffer < StringIO
def initialize
super.binmode
end
def empty?
length.zero?
end
def reset
truncate 0
rewind
end
def to_s
rewind
read
end
# Read & Reset - returns contents a... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/configuration.rb | lib/puma/configuration.rb | # frozen_string_literal: true
require_relative 'plugin'
require_relative 'const'
require_relative 'dsl'
require_relative 'events'
module Puma
# A class used for storing "leveled" configuration options.
#
# In this class any "user" specified options take precedence over any
# "file" specified options, take pre... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/runner.rb | lib/puma/runner.rb | # frozen_string_literal: true
require_relative 'server'
require_relative 'const'
module Puma
# Generic class that is used by `Puma::Cluster` and `Puma::Single` to
# serve requests. This class spawns a new instance of `Puma::Server` via
# a call to `start_server`.
class Runner
include ::Puma::Const::PipeR... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/jruby_restart.rb | lib/puma/jruby_restart.rb | # frozen_string_literal: true
require 'ffi'
module Puma
module JRubyRestart
extend FFI::Library
ffi_lib 'c'
attach_function :chdir, [:string], :int
end
end
| ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/detect.rb | lib/puma/detect.rb | # frozen_string_literal: true
# This file can be loaded independently of puma.rb, so it cannot have any code
# that assumes puma.rb is loaded.
module Puma
# @version 5.2.1
HAS_FORK = ::Process.respond_to? :fork
HAS_NATIVE_IO_WAIT = ::IO.public_instance_methods(false).include? :wait_readable
IS_JRUBY = Obje... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/thread_pool.rb | lib/puma/thread_pool.rb | # frozen_string_literal: true
require 'thread'
require_relative 'io_buffer'
module Puma
# Add `Thread#puma_server` and `Thread#puma_server=`
Thread.attr_accessor(:puma_server)
# Internal Docs for A simple thread pool management object.
#
# Each Puma "worker" has a thread pool to process requests.
#
#... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/cli.rb | lib/puma/cli.rb | # frozen_string_literal: true
require 'optparse'
require 'uri'
require_relative '../puma'
require_relative 'configuration'
require_relative 'launcher'
require_relative 'const'
require_relative 'log_writer'
module Puma
class << self
# The CLI exports a Puma::Configuration instance here to allow
# apps to pi... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/launcher.rb | lib/puma/launcher.rb | # frozen_string_literal: true
require_relative 'log_writer'
require_relative 'events'
require_relative 'detect'
require_relative 'cluster'
require_relative 'single'
require_relative 'const'
require_relative 'binder'
module Puma
# Puma::Launcher is the single entry point for starting a Puma server based on user
# ... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/client.rb | lib/puma/client.rb | # frozen_string_literal: true
require_relative 'detect'
require_relative 'io_buffer'
require 'tempfile'
if Puma::IS_JRUBY
# We have to work around some OpenSSL buffer/io-readiness bugs
# so we pull it in regardless of if the user is binding
# to an SSL socket
require 'openssl'
end
module Puma
class Connec... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/server.rb | lib/puma/server.rb | # frozen_string_literal: true
require 'stringio'
require_relative 'thread_pool'
require_relative 'const'
require_relative 'log_writer'
require_relative 'events'
require_relative 'null_io'
require_relative 'reactor'
require_relative 'client'
require_relative 'binder'
require_relative 'util'
require_relative 'request'
... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
puma/puma | https://github.com/puma/puma/blob/5937d8953a154d69cab13887cc361eef9d7df2a4/lib/puma/request.rb | lib/puma/request.rb | # frozen_string_literal: true
module Puma
#ββββββββββββββββββββββββ DO NOT USE β this class is for internal use only βββ
# The methods here are included in Server, but are separated into this file.
# All the methods here pertain to passing the request to the app, then
# writing the response back to the clien... | ruby | BSD-3-Clause | 5937d8953a154d69cab13887cc361eef9d7df2a4 | 2026-01-04T15:39:19.886485Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.