Show More
@@ -116,6 +116,17 b' class BaseVCSController(object):' | |||
|
116 | 116 | |
|
117 | 117 | return True |
|
118 | 118 | |
|
119 | def _get_ip_addr(self, environ): | |
|
120 | proxy_key = 'HTTP_X_REAL_IP' | |
|
121 | proxy_key2 = 'HTTP_X_FORWARDED_FOR' | |
|
122 | def_key = 'REMOTE_ADDR' | |
|
123 | ||
|
124 | return environ.get(proxy_key2, | |
|
125 | environ.get(proxy_key, | |
|
126 | environ.get(def_key, '0.0.0.0') | |
|
127 | ) | |
|
128 | ) | |
|
129 | ||
|
119 | 130 | def __call__(self, environ, start_response): |
|
120 | 131 | start = time.time() |
|
121 | 132 | try: |
@@ -99,9 +99,7 b' class SimpleGit(BaseVCSController):' | |||
|
99 | 99 | if not is_git(environ): |
|
100 | 100 | return self.application(environ, start_response) |
|
101 | 101 | |
|
102 | proxy_key = 'HTTP_X_REAL_IP' | |
|
103 | def_key = 'REMOTE_ADDR' | |
|
104 | ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0')) | |
|
102 | ipaddr = self._get_ip_addr(environ) | |
|
105 | 103 | username = None |
|
106 | 104 | # skip passing error to error controller |
|
107 | 105 | environ['pylons.status_code_redirect'] = True |
@@ -69,9 +69,7 b' class SimpleHg(BaseVCSController):' | |||
|
69 | 69 | if not is_mercurial(environ): |
|
70 | 70 | return self.application(environ, start_response) |
|
71 | 71 | |
|
72 | proxy_key = 'HTTP_X_REAL_IP' | |
|
73 | def_key = 'REMOTE_ADDR' | |
|
74 | ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0')) | |
|
72 | ipaddr = self._get_ip_addr(environ) | |
|
75 | 73 | |
|
76 | 74 | # skip passing error to error controller |
|
77 | 75 | environ['pylons.status_code_redirect'] = True |
General Comments 0
You need to be logged in to leave comments.
Login now