##// END OF EJS Templates
git-lfs: fixed bug #5399 git-lfs application failed to generate HTTPS urls properly.
dan -
r3781:b4126386 default
parent child Browse files
Show More
@@ -142,7 +142,7 b' class SimpleGit(simplevcs.SimpleVCS):'
142 return self.scm_app.create_git_wsgi_app(
142 return self.scm_app.create_git_wsgi_app(
143 repo_path, repo_name, config)
143 repo_path, repo_name, config)
144
144
145 def _create_config(self, extras, repo_name):
145 def _create_config(self, extras, repo_name, scheme='http'):
146 extras['git_update_server_info'] = utils2.str2bool(
146 extras['git_update_server_info'] = utils2.str2bool(
147 rhodecode.CONFIG.get('git_update_server_info'))
147 rhodecode.CONFIG.get('git_update_server_info'))
148
148
@@ -152,4 +152,5 b' class SimpleGit(simplevcs.SimpleVCS):'
152 extras['git_lfs_enabled'] = utils2.str2bool(
152 extras['git_lfs_enabled'] = utils2.str2bool(
153 config.get('vcs_git_lfs', 'enabled'))
153 config.get('vcs_git_lfs', 'enabled'))
154 extras['git_lfs_store_path'] = custom_store or default_lfs_store()
154 extras['git_lfs_store_path'] = custom_store or default_lfs_store()
155 extras['git_lfs_http_scheme'] = scheme
155 return extras
156 return extras
@@ -153,7 +153,7 b' class SimpleHg(simplevcs.SimpleVCS):'
153 def _create_wsgi_app(self, repo_path, repo_name, config):
153 def _create_wsgi_app(self, repo_path, repo_name, config):
154 return self.scm_app.create_hg_wsgi_app(repo_path, repo_name, config)
154 return self.scm_app.create_hg_wsgi_app(repo_path, repo_name, config)
155
155
156 def _create_config(self, extras, repo_name):
156 def _create_config(self, extras, repo_name, scheme='http'):
157 config = utils.make_db_config(repo=repo_name)
157 config = utils.make_db_config(repo=repo_name)
158 config.set('rhodecode', 'RC_SCM_DATA', json.dumps(extras))
158 config.set('rhodecode', 'RC_SCM_DATA', json.dumps(extras))
159
159
@@ -219,7 +219,7 b' class SimpleSvn(simplevcs.SimpleVCS):'
219 conf = self.repo_vcs_config
219 conf = self.repo_vcs_config
220 return str2bool(conf.get('vcs_svn_proxy', 'http_requests_enabled'))
220 return str2bool(conf.get('vcs_svn_proxy', 'http_requests_enabled'))
221
221
222 def _create_config(self, extras, repo_name):
222 def _create_config(self, extras, repo_name, scheme='http'):
223 conf = self.repo_vcs_config
223 conf = self.repo_vcs_config
224 server_url = conf.get('vcs_svn_proxy', 'http_server_url')
224 server_url = conf.get('vcs_svn_proxy', 'http_server_url')
225 server_url = server_url or self.DEFAULT_HTTP_SERVER
225 server_url = server_url or self.DEFAULT_HTTP_SERVER
@@ -360,6 +360,13 b' class SimpleVCS(object):'
360
360
361 return perm_result
361 return perm_result
362
362
363 def _get_http_scheme(self, environ):
364 try:
365 return environ['wsgi.url_scheme']
366 except Exception:
367 log.exception('Failed to read http scheme')
368 return 'http'
369
363 def _check_ssl(self, environ, start_response):
370 def _check_ssl(self, environ, start_response):
364 """
371 """
365 Checks the SSL check flag and returns False if SSL is not present
372 Checks the SSL check flag and returns False if SSL is not present
@@ -597,7 +604,9 b' class SimpleVCS(object):'
597 extras, environ, action, txn_id=txn_id)
604 extras, environ, action, txn_id=txn_id)
598 log.debug('HOOKS extras is %s', extras)
605 log.debug('HOOKS extras is %s', extras)
599
606
600 config = self._create_config(extras, self.acl_repo_name)
607 http_scheme = self._get_http_scheme(environ)
608
609 config = self._create_config(extras, self.acl_repo_name, scheme=http_scheme)
601 app = self._create_wsgi_app(repo_path, self.url_repo_name, config)
610 app = self._create_wsgi_app(repo_path, self.url_repo_name, config)
602 with callback_daemon:
611 with callback_daemon:
603 app.rc_extras = extras
612 app.rc_extras = extras
@@ -643,7 +652,7 b' class SimpleVCS(object):'
643 """Return the WSGI app that will finally handle the request."""
652 """Return the WSGI app that will finally handle the request."""
644 raise NotImplementedError()
653 raise NotImplementedError()
645
654
646 def _create_config(self, extras, repo_name):
655 def _create_config(self, extras, repo_name, scheme='http'):
647 """Create a safe config representation."""
656 """Create a safe config representation."""
648 raise NotImplementedError()
657 raise NotImplementedError()
649
658
@@ -121,7 +121,8 b' def test_get_config(user_util, baseapp, '
121 expected_config.update({
121 expected_config.update({
122 'git_update_server_info': False,
122 'git_update_server_info': False,
123 'git_lfs_enabled': False,
123 'git_lfs_enabled': False,
124 'git_lfs_store_path': git_config['git_lfs_store_path']
124 'git_lfs_store_path': git_config['git_lfs_store_path'],
125 'git_lfs_http_scheme': 'http'
125 })
126 })
126
127
127 assert git_config == expected_config
128 assert git_config == expected_config
@@ -69,7 +69,7 b' class StubVCSController(simplevcs.Simple'
69 return self.stub_response_body
69 return self.stub_response_body
70 return fake_app
70 return fake_app
71
71
72 def _create_config(self, extras, repo_name):
72 def _create_config(self, extras, repo_name, scheme='http'):
73 return None
73 return None
74
74
75
75
General Comments 0
You need to be logged in to leave comments. Login now