Show More
@@ -23,6 +23,7 b' import wsgiref.util' | |||
|
23 | 23 | import traceback |
|
24 | 24 | from itertools import chain |
|
25 | 25 | |
|
26 | import simplejson as json | |
|
26 | 27 | import msgpack |
|
27 | 28 | from beaker.cache import CacheManager |
|
28 | 29 | from beaker.util import parse_cache_config_options |
@@ -311,6 +312,25 b' class HTTPApplication(object):' | |||
|
311 | 312 | return value |
|
312 | 313 | return _render |
|
313 | 314 | |
|
315 | def set_env_from_config(self, environ, config): | |
|
316 | dict_conf = {} | |
|
317 | try: | |
|
318 | for elem in config: | |
|
319 | if elem[0] == 'rhodecode': | |
|
320 | dict_conf = json.loads(elem[2]) | |
|
321 | break | |
|
322 | except Exception: | |
|
323 | log.exception('Failed to fetch SCM CONFIG') | |
|
324 | return | |
|
325 | ||
|
326 | username = dict_conf.get('username') | |
|
327 | if username: | |
|
328 | environ['REMOTE_USER'] = username | |
|
329 | ||
|
330 | ip = dict_conf.get('ip') | |
|
331 | if ip: | |
|
332 | environ['REMOTE_HOST'] = ip | |
|
333 | ||
|
314 | 334 | def hg_proxy(self): |
|
315 | 335 | @wsgiapp |
|
316 | 336 | def _hg_proxy(environ, start_response): |
@@ -344,9 +364,11 b' class HTTPApplication(object):' | |||
|
344 | 364 | app = scm_app.create_hg_wsgi_app( |
|
345 | 365 | repo_path, repo_name, config) |
|
346 | 366 | |
|
347 | # Consitent path information for hgweb | |
|
367 | # Consistent path information for hgweb | |
|
348 | 368 | environ['PATH_INFO'] = environ['HTTP_X_RC_PATH_INFO'] |
|
349 | 369 | environ['REPO_NAME'] = repo_name |
|
370 | self.set_env_from_config(environ, config) | |
|
371 | ||
|
350 | 372 | log.debug('http-app: starting app handler ' |
|
351 | 373 | 'with %s and process request', app) |
|
352 | 374 | return app(environ, ResponseFilter(start_response)) |
@@ -370,6 +392,8 b' class HTTPApplication(object):' | |||
|
370 | 392 | config = msgpack.unpackb(packed_config) |
|
371 | 393 | |
|
372 | 394 | environ['PATH_INFO'] = environ['HTTP_X_RC_PATH_INFO'] |
|
395 | self.set_env_from_config(environ, config) | |
|
396 | ||
|
373 | 397 | content_type = environ.get('CONTENT_TYPE', '') |
|
374 | 398 | |
|
375 | 399 | path = environ['PATH_INFO'] |
General Comments 0
You need to be logged in to leave comments.
Login now