Skip to content

Commit

Permalink
Use new Protocol::HTTP::Peer interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Nov 9, 2024
1 parent 16a29d5 commit f44069d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/protocol/rack/adapter/generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,8 @@ def unwrap_request(request, env)
# HTTP/2 prefers `:authority` over `host`, so we do this for backwards compatibility.
env[CGI::HTTP_HOST] ||= request.authority

if request.respond_to?(:remote_address)
if remote_address = request.remote_address
env[CGI::REMOTE_ADDR] = remote_address.ip_address if remote_address.ip?
end
if peer = request.peer
env[CGI::REMOTE_ADDR] = peer.ip_address
end
end

Expand Down
2 changes: 1 addition & 1 deletion protocol-rack.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 3.1"

spec.add_dependency "protocol-http", "~> 0.37"
spec.add_dependency "protocol-http", "~> 0.43"
spec.add_dependency "rack", ">= 1.0"
end

0 comments on commit f44069d

Please sign in to comment.