Fix wrong attribute to find remote address

The webob.Request class does not have the remote_address attribute but
the remote_addr attribute. This change fixes usage of the non-existing
attribute accordingly.

Closes-Bug: #1967683
Change-Id: I5b9276b39b3ff314e3cd684202a40c2687ac0bdb
This commit is contained in:
Hervé Beraud 2022-04-20 13:23:04 +02:00
parent a351c3ac51
commit e9904eafb1

View File

@ -137,7 +137,7 @@ class NoAuthMiddleware(base_wsgi.Middleware):
token = req.headers['X-Auth-Token']
user_id, _sep, project_id = token.partition(':')
project_id = project_id or user_id
remote_address = getattr(req, 'remote_address', '127.0.0.1')
remote_address = getattr(req, 'remote_addr', '127.0.0.1')
if CONF.use_forwarded_for:
remote_address = req.headers.get('X-Forwarded-For', remote_address)
ctx = context.RequestContext(user_id,