retreive real client IP

This commit is contained in:
Emmanuel Viennet 2021-09-18 21:35:52 +02:00
parent c4c37fedfb
commit c5e5e02639

View File

@ -138,11 +138,12 @@ def version():
"""
echo -e "DATE\tIP\tSVN\tSERIAL\tOP" > installs.log; chown scodoc installs.log
"""
remote_addr = request.environ.get("HTTP_X_Real_IP", request.remote_addr)
remote_addr = request.environ.get("HTTP_X_REAL_IP", request.remote_addr)
mode = request.args.get("mode", "?")
sn = request.args.get("sn", "-1") # serial number
svn = request.args.get("svn", "-") # installed subversion
commit = request.args.get("commit", "-") # installed git commit
svn = request.args.get("svn", "-") # installed subversion (ScoDoc 7)
release = request.args.get("release", "") # ScoDoc 9 prod installs
commit = request.args.get("commit", "") # installed git commit (devs)
if mode == "install" or not sn:
serial = increment()
else:
@ -154,7 +155,7 @@ def version():
% (
time.strftime("%Y-%m-%d %H:%M:%S"),
remote_addr,
svn or commit,
svn or commit or release or "-",
serial,
mode,
)