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:
parent
cc4ad17519
commit
9fc65acee7
2 changed files with 14 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -456,6 +456,7 @@ module Puma
|
|||
# intermediary acting on behalf of the actual source client."
|
||||
#
|
||||
|
||||
unless env.key?(REMOTE_ADDR)
|
||||
addr = client.peeraddr.last
|
||||
|
||||
# Set unix socket addrs to localhost
|
||||
|
@ -463,6 +464,7 @@ module Puma
|
|||
|
||||
env[REMOTE_ADDR] = addr
|
||||
end
|
||||
end
|
||||
|
||||
def default_server_port(env)
|
||||
env['HTTP_X_FORWARDED_PROTO'] == 'https' ? PORT_443 : PORT_80
|
||||
|
|
Loading…
Reference in a new issue