##// END OF EJS Templates
vcs: Add custom response header 'X-RhodeCode-Backend' to indicate VCS responses and which backend is in use.
Martin Bornhold -
r608:74424d4b default
parent child Browse files
Show More
@@ -79,12 +79,18 b' class SimpleSvnApp(object):'
79 79 return headers
80 80
81 81 def _get_response_headers(self, headers):
82 return [
82 headers = [
83 83 (h, headers[h])
84 84 for h in headers
85 85 if h.lower() not in self.IGNORED_HEADERS
86 86 ]
87 87
88 # Add custom response header to indicate that this is a VCS response
89 # and which backend is used.
90 headers.append(('X-RhodeCode-Backend', 'svn'))
91
92 return headers
93
88 94
89 95 class SimpleSvn(simplevcs.SimpleVCS):
90 96
@@ -39,12 +39,12 b' log = logging.getLogger(__name__)'
39 39
40 40 def create_git_wsgi_app(repo_path, repo_name, config):
41 41 url = _vcs_streaming_url() + 'git/'
42 return VcsHttpProxy(url, repo_path, repo_name, config)
42 return VcsHttpProxy(url, repo_path, repo_name, config, 'git')
43 43
44 44
45 45 def create_hg_wsgi_app(repo_path, repo_name, config):
46 46 url = _vcs_streaming_url() + 'hg/'
47 return VcsHttpProxy(url, repo_path, repo_name, config)
47 return VcsHttpProxy(url, repo_path, repo_name, config, 'hg')
48 48
49 49
50 50 def _vcs_streaming_url():
@@ -67,7 +67,7 b' class VcsHttpProxy(object):'
67 67 server as well.
68 68 """
69 69
70 def __init__(self, url, repo_path, repo_name, config):
70 def __init__(self, url, repo_path, repo_name, config, backend):
71 71 """
72 72 :param str url: The URL of the VCSServer to call.
73 73 """
@@ -75,6 +75,7 b' class VcsHttpProxy(object):'
75 75 self._repo_name = repo_name
76 76 self._repo_path = repo_path
77 77 self._config = config
78 self._backend = backend
78 79 log.debug(
79 80 "Creating VcsHttpProxy for repo %s, url %s",
80 81 repo_name, url)
@@ -115,6 +116,10 b' class VcsHttpProxy(object):'
115 116 if not wsgiref.util.is_hop_by_hop(h)
116 117 ]
117 118
119 # Add custom response header to indicate that this is a VCS response
120 # and which backend is used.
121 response_headers.append(('X-RhodeCode-Backend', self._backend))
122
118 123 # TODO: johbo: Better way to get the status including text?
119 124 status = str(response.status_code)
120 125 start_response(status, response_headers)
General Comments 0
You need to be logged in to leave comments. Login now