Show More
@@ -48,6 +48,7 b' class SimpleSvnApp(object):' | |||
|
48 | 48 | |
|
49 | 49 | def __init__(self, config): |
|
50 | 50 | self.config = config |
|
51 | self.session = requests.Session() | |
|
51 | 52 | |
|
52 | 53 | def __call__(self, environ, start_response): |
|
53 | 54 | request_headers = self._get_request_headers(environ) |
@@ -94,10 +95,17 b' class SimpleSvnApp(object):' | |||
|
94 | 95 | log.debug('Calling SVN PROXY at `%s`, using method:%s. Stream: %s', |
|
95 | 96 | path_info, req_method, stream) |
|
96 | 97 | |
|
98 | call_kwargs = dict( | |
|
99 | data=data_io, | |
|
100 | headers=request_headers, | |
|
101 | stream=stream | |
|
102 | ) | |
|
103 | if req_method in ['HEAD', 'DELETE']: | |
|
104 | del call_kwargs['data'] | |
|
105 | ||
|
97 | 106 | try: |
|
98 |
response = |
|
|
99 | req_method, path_info, | |
|
100 | data=data_io, headers=request_headers, stream=stream) | |
|
107 | response = self.session.request( | |
|
108 | req_method, path_info, **call_kwargs) | |
|
101 | 109 | except requests.ConnectionError: |
|
102 | 110 | log.exception('ConnectionError occurred for endpoint %s', path_info) |
|
103 | 111 | raise |
@@ -63,11 +63,12 b' from rhodecode.model.settings import Set' | |||
|
63 | 63 | log = logging.getLogger(__name__) |
|
64 | 64 | |
|
65 | 65 | |
|
66 | def extract_svn_txn_id(acl_repo_name, data): | |
|
66 | def extract_svn_txn_id(acl_repo_name, data: bytes): | |
|
67 | 67 | """ |
|
68 | 68 | Helper method for extraction of svn txn_id from submitted XML data during |
|
69 | 69 | POST operations |
|
70 | 70 | """ |
|
71 | ||
|
71 | 72 | try: |
|
72 | 73 | root = etree.fromstring(data) |
|
73 | 74 | pat = re.compile(r'/txn/(?P<txn_id>.*)') |
@@ -609,13 +610,13 b' class SimpleVCS(object):' | |||
|
609 | 610 | stream = environ['wsgi.input'] |
|
610 | 611 | |
|
611 | 612 | if isinstance(stream, io.BytesIO): |
|
612 |
data: |
|
|
613 | data: bytes = stream.getvalue() | |
|
613 | 614 | elif hasattr(stream, 'buf'): # most likely gunicorn.http.body.Body |
|
614 |
data: |
|
|
615 | data: bytes = stream.buf.getvalue() | |
|
615 | 616 | else: |
|
616 | 617 | # fallback to the crudest way, copy the iterator |
|
617 |
data = safe_ |
|
|
618 |
environ['wsgi.input'] = io.BytesIO( |
|
|
618 | data = safe_bytes(stream.read()) | |
|
619 | environ['wsgi.input'] = io.BytesIO(data) | |
|
619 | 620 | |
|
620 | 621 | txn_id = extract_svn_txn_id(self.acl_repo_name, data) |
|
621 | 622 |
@@ -84,10 +84,12 b' def is_svn(environ):' | |||
|
84 | 84 | magic_path_segment = rhodecode.CONFIG.get( |
|
85 | 85 | 'rhodecode_subversion_magic_path', '/!svn') |
|
86 | 86 | path_info = get_path_info(environ) |
|
87 | req_method = environ['REQUEST_METHOD'] | |
|
88 | ||
|
87 | 89 | is_svn_path = ( |
|
88 | 90 | 'subversion' in http_dav or |
|
89 | 91 | magic_path_segment in path_info |
|
90 |
or |
|
|
92 | or req_method in ['PROPFIND', 'PROPPATCH', 'HEAD'] | |
|
91 | 93 | ) |
|
92 | 94 | log.debug( |
|
93 | 95 | 'request path: `%s` detected as SVN PROTOCOL %s', path_info, |
@@ -187,6 +189,7 b' def detect_vcs_request(environ, backends' | |||
|
187 | 189 | ] |
|
188 | 190 | path_info = get_path_info(environ) |
|
189 | 191 | path_url = path_info.lstrip('/') |
|
192 | req_method = environ.get('REQUEST_METHOD') | |
|
190 | 193 | |
|
191 | 194 | for item in white_list: |
|
192 | 195 | if item.endswith('++') and path_url.startswith(item[:-2]): |
@@ -210,7 +213,8 b' def detect_vcs_request(environ, backends' | |||
|
210 | 213 | log.debug('got handler:%s from environ', handler) |
|
211 | 214 | |
|
212 | 215 | if not handler: |
|
213 |
log.debug('request start: checking if request for `%s` is of VCS type in order: %s', |
|
|
216 | log.debug('request start: checking if request for `%s:%s` is of VCS type in order: %s', | |
|
217 | req_method, path_url, backends) | |
|
214 | 218 | for vcs_type in backends: |
|
215 | 219 | vcs_check, _handler = checks[vcs_type] |
|
216 | 220 | if vcs_check(environ): |
General Comments 0
You need to be logged in to leave comments.
Login now