# HG changeset patch # User Daniel Dourvaris # Date 2020-05-20 12:15:47 # Node ID 122ebfb883430798a2b28a05cb42994bc3ef7b44 # Parent 2d86851ba7ba82e50f63aac8c0c71bb211857c3e vcs: expose more information for http protocol. Increased capabilities with external hooks. - fixes #5574 diff --git a/rhodecode/lib/middleware/utils/scm_app_http.py b/rhodecode/lib/middleware/utils/scm_app_http.py --- a/rhodecode/lib/middleware/utils/scm_app_http.py +++ b/rhodecode/lib/middleware/utils/scm_app_http.py @@ -79,6 +79,7 @@ class VcsHttpProxy(object): self._repo_name = repo_name self._repo_path = repo_path self._config = config + self.rc_extras = {} log.debug( "Creating VcsHttpProxy for repo %s, url %s", repo_name, url) @@ -87,14 +88,23 @@ class VcsHttpProxy(object): config = msgpack.packb(self._config) request = webob.request.Request(environ) request_headers = request.headers + request_headers.update({ # TODO: johbo: Remove this, rely on URL path only 'X-RC-Repo-Name': self._repo_name, 'X-RC-Repo-Path': self._repo_path, 'X-RC-Path-Info': environ['PATH_INFO'], + + 'X-RC-Repo-Store': self.rc_extras.get('repo_store'), + 'X-RC-Server-Config-File': self.rc_extras.get('config'), + + 'X-RC-Auth-User': self.rc_extras.get('username'), + 'X-RC-Auth-User-Id': self.rc_extras.get('user_id'), + 'X-RC-Auth-User-Ip': self.rc_extras.get('ip'), + # TODO: johbo: Avoid encoding and put this into payload? 'X-RC-Repo-Config': base64.b64encode(config), - 'X-RC-Locked-Status-Code': rhodecode.CONFIG.get('lock_ret_code') + 'X-RC-Locked-Status-Code': rhodecode.CONFIG.get('lock_ret_code'), }) method = environ['REQUEST_METHOD']