##// END OF EJS Templates
subversion: Detect requests also based on magic path.
johbo -
r437:28802ace default
parent child Browse files
Show More
@@ -72,7 +72,11 b' def is_svn(environ):'
72 Returns True if requests target is Subversion server
72 Returns True if requests target is Subversion server
73 """
73 """
74 http_dav = environ.get('HTTP_DAV', '')
74 http_dav = environ.get('HTTP_DAV', '')
75 is_svn_path = 'subversion' in http_dav
75 magic_path_segment = rhodecode.CONFIG.get(
76 'rhodecode_subversion_magic_path', '/!svn')
77 is_svn_path = (
78 'subversion' in http_dav or
79 magic_path_segment in environ['PATH_INFO'])
76 log.debug(
80 log.debug(
77 'request path: `%s` detected as SVN PROTOCOL %s', environ['PATH_INFO'],
81 'request path: `%s` detected as SVN PROTOCOL %s', environ['PATH_INFO'],
78 is_svn_path)
82 is_svn_path)
@@ -74,6 +74,26 b' def test_is_svn_returns_false_if_no_dav_'
74 assert vcs.is_svn(environ) is False
74 assert vcs.is_svn(environ) is False
75
75
76
76
77 def test_is_svn_returns_true_if_magic_path_segment():
78 environ = {
79 'PATH_INFO': '/stub-repository/!svn/rev/4',
80 }
81 assert vcs.is_svn(environ)
82
83
84 def test_is_svn_allows_to_configure_the_magic_path(monkeypatch):
85 """
86 This is intended as a fallback in case someone has configured his
87 Subversion server with a different magic path segment.
88 """
89 monkeypatch.setitem(
90 rhodecode.CONFIG, 'rhodecode_subversion_magic_path', '/!my-magic')
91 environ = {
92 'PATH_INFO': '/stub-repository/!my-magic/rev/4',
93 }
94 assert vcs.is_svn(environ)
95
96
77 class TestVCSMiddleware(object):
97 class TestVCSMiddleware(object):
78 def test_get_handler_app_retuns_svn_app_when_proxy_enabled(self):
98 def test_get_handler_app_retuns_svn_app_when_proxy_enabled(self):
79 environ = {
99 environ = {
General Comments 0
You need to be logged in to leave comments. Login now