diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-09-30 17:55:06 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-09-30 17:55:06 +0100 |
commit | 9605593d11b67199a98ed25f121a2af2e1c9587a (patch) | |
tree | dc57897bfcbd1591fa0dfb219e376353584654e9 /synapse/server.py | |
parent | SYN-75 Verify signatures on server to server transactions (diff) | |
parent | pyflakes cleanup (diff) | |
download | synapse-9605593d11b67199a98ed25f121a2af2e1c9587a.tar.xz |
Merge branch 'develop' into server2server_signing
Conflicts: synapse/storage/__init__.py tests/rest/test_presence.py
Diffstat (limited to 'synapse/server.py')
-rw-r--r-- | synapse/server.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/server.py b/synapse/server.py index ed5b810d3e..a4d2d4aba5 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -146,6 +146,18 @@ class BaseHomeServer(object): def serialize_event(self, e): return serialize_event(self, e) + def get_ip_from_request(self, request): + # May be an X-Forwarding-For header depending on config + ip_addr = request.getClientIP() + if self.config.captcha_ip_origin_is_x_forwarded: + # use the header + if request.requestHeaders.hasHeader("X-Forwarded-For"): + ip_addr = request.requestHeaders.getRawHeaders( + "X-Forwarded-For" + )[0] + + return ip_addr + # Build magic accessors for every dependency for depname in BaseHomeServer.DEPENDENCIES: BaseHomeServer._make_dependency_method(depname) |