Commits

Ian Bicking committed ff0c942

Use X-Forwarded-For in translogger: http://trac.pythonpaste.org/pythonpaste/ticket/412 -- also news for last commits

  • Participants
  • Parent commits e4084f2

Comments (0)

Files changed (2)

 tip
 ---
 
+* Won't install ``tests/`` directory (also caused installation
+  problems on some Mac systems).
+
+* Fixed problem with gzip middleware and zero-length responses.
+
+* Use ``X-Forwarded-For`` header in :mod:`paste.translogger`
+
 * Fixed problems with mimeparse code
 
 * Fixed some corner cases with CGI scripts

paste/translogger.py

                 offset = "+%0.4d" % (offset)
         elif offset < 0:
                 offset = "%0.4d" % (offset)
+        remote_addr = '-'
+        if environ.get('HTTP_X_FORWARDED_FOR'):
+            remote_addr = environ['HTTP_X_FORWARDED_FOR']
+        elif environ.get('REMOTE_ADDR'):
+            remote_addr = environ['REMOTE_ADDR']
         d = {
-            'REMOTE_ADDR': environ.get('REMOTE_ADDR') or '-',
+            'REMOTE_ADDR': remote_addr,
             'REMOTE_USER': environ.get('REMOTE_USER') or '-',
             'REQUEST_METHOD': method,
             'REQUEST_URI': req_uri,