##// 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 142 return self.scm_app.create_git_wsgi_app(
143 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 146 extras['git_update_server_info'] = utils2.str2bool(
147 147 rhodecode.CONFIG.get('git_update_server_info'))
148 148
@@ -152,4 +152,5 b' class SimpleGit(simplevcs.SimpleVCS):'
152 152 extras['git_lfs_enabled'] = utils2.str2bool(
153 153 config.get('vcs_git_lfs', 'enabled'))
154 154 extras['git_lfs_store_path'] = custom_store or default_lfs_store()
155 extras['git_lfs_http_scheme'] = scheme
155 156 return extras
@@ -153,7 +153,7 b' class SimpleHg(simplevcs.SimpleVCS):'
153 153 def _create_wsgi_app(self, repo_path, repo_name, config):
154 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 157 config = utils.make_db_config(repo=repo_name)
158 158 config.set('rhodecode', 'RC_SCM_DATA', json.dumps(extras))
159 159
@@ -219,7 +219,7 b' class SimpleSvn(simplevcs.SimpleVCS):'
219 219 conf = self.repo_vcs_config
220 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 223 conf = self.repo_vcs_config
224 224 server_url = conf.get('vcs_svn_proxy', 'http_server_url')
225 225 server_url = server_url or self.DEFAULT_HTTP_SERVER
@@ -360,6 +360,13 b' class SimpleVCS(object):'
360 360
361 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 370 def _check_ssl(self, environ, start_response):
364 371 """
365 372 Checks the SSL check flag and returns False if SSL is not present
@@ -597,7 +604,9 b' class SimpleVCS(object):'
597 604 extras, environ, action, txn_id=txn_id)
598 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 610 app = self._create_wsgi_app(repo_path, self.url_repo_name, config)
602 611 with callback_daemon:
603 612 app.rc_extras = extras
@@ -643,7 +652,7 b' class SimpleVCS(object):'
643 652 """Return the WSGI app that will finally handle the request."""
644 653 raise NotImplementedError()
645 654
646 def _create_config(self, extras, repo_name):
655 def _create_config(self, extras, repo_name, scheme='http'):
647 656 """Create a safe config representation."""
648 657 raise NotImplementedError()
649 658
@@ -121,7 +121,8 b' def test_get_config(user_util, baseapp, '
121 121 expected_config.update({
122 122 'git_update_server_info': False,
123 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 128 assert git_config == expected_config
@@ -69,7 +69,7 b' class StubVCSController(simplevcs.Simple'
69 69 return self.stub_response_body
70 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 73 return None
74 74
75 75
General Comments 0
You need to be logged in to leave comments. Login now