1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Set a default REMOTE_ADDR to avoid using peeraddr on unix sockets. Fixes #583

This commit is contained in:
Evan Phoenix 2015-01-20 10:34:14 -08:00
parent cc4ad17519
commit 9fc65acee7
2 changed files with 14 additions and 4 deletions

View file

@ -288,6 +288,10 @@ module Puma
File.chmod mode, path
end
env = @proto_env.dup
env[REMOTE_ADDR] = "127.0.0.1"
@envs[s] = env
s
end
@ -301,6 +305,10 @@ module Puma
end
@ios << s
env = @proto_env.dup
env[REMOTE_ADDR] = "127.0.0.1"
@envs[s] = env
s
end

View file

@ -456,12 +456,14 @@ module Puma
# intermediary acting on behalf of the actual source client."
#
addr = client.peeraddr.last
unless env.key?(REMOTE_ADDR)
addr = client.peeraddr.last
# Set unix socket addrs to localhost
addr = "127.0.0.1" if addr.empty?
# Set unix socket addrs to localhost
addr = "127.0.0.1" if addr.empty?
env[REMOTE_ADDR] = addr
env[REMOTE_ADDR] = addr
end
end
def default_server_port(env)