Skip to content

Commit

Permalink
Minor puma.rb and rack/version_restriction.rb changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MSP-Greg committed May 30, 2023
1 parent ede389a commit de11d4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

require 'thread'

# extension files should not be loaded with `require_relative`
require 'puma/puma_http11'
require 'puma/detect'
require 'puma/json_serialization'

require 'rack/version_restriction'
require_relative 'puma/detect'
require_relative 'puma/json_serialization'
require_relative 'rack/version_restriction'

module Puma
autoload :Const, 'puma/const'
Expand Down
9 changes: 8 additions & 1 deletion lib/rack/version_restriction.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
begin
require 'rack'
begin
# rack/version exists in Rack 2.2.0 and later, compatible with Ruby 2.3 and later
# we prefer to not load Rack
require 'rack/version'
rescue LoadError
require 'rack'
end

# Rack.release is needed for Rack v1, Rack::RELEASE was added in v2
if Gem::Version.new(Rack.release) >= Gem::Version.new("3.0.0")
raise StandardError.new "Puma 5 is not compatible with Rack 3, please upgrade to Puma 6 or higher."
end
Expand Down

0 comments on commit de11d4d

Please sign in to comment.