Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Revert "more login hacking"
Browse files Browse the repository at this point in the history
This reverts commit 47d2b49.

This has now been superceded on develop by PR 9472.
  • Loading branch information
richvdh committed Feb 26, 2021
1 parent 5d405f7 commit c7934ae
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions synapse/http/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,28 +333,14 @@ def _should_log_request(self) -> bool:


class XForwardedForRequest(SynapseRequest):
def __init__(self, *args, **kw):
SynapseRequest.__init__(self, *args, **kw)

"""
Add a layer on top of another request that only uses the value of an
X-Forwarded-For header as the result of C{getClientIP}.
XXX: I think the right way to do this is with request.setHost().
"""

def __init__(self, *args, **kw):
SynapseRequest.__init__(self, *args, **kw)

forwarded_header = self.getHeader(b"x-forwarded-proto")
if forwarded_header is not None:
self._is_secure = forwarded_header.lower() == b"https"
else:
logger.warning(
"received request lacks an x-forwarded-proto header: assuming https"
)
self._is_secure = True

def isSecure(self):
return self._is_secure

def getClientIP(self):
"""
@return: The client address (the first address) in the value of the
Expand Down

0 comments on commit c7934ae

Please sign in to comment.