Mercurial > hg-stable
diff mercurial/hgweb/hgweb_mod.py @ 2673:109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
all repository classes now have url() method that returns url of repo.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Tue, 25 Jul 2006 13:50:32 -0700 |
parents | ebf033bc8eb2 |
children | 2edfd6644a9f |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Tue Jul 25 21:22:56 2006 +0200 +++ b/mercurial/hgweb/hgweb_mod.py Tue Jul 25 13:50:32 2006 -0700 @@ -904,9 +904,13 @@ # require ssl by default, auth info cannot be sniffed and # replayed ssl_req = self.repo.ui.configbool('web', 'push_ssl', True) - if ssl_req and not req.env.get('HTTPS'): - bail(_('ssl required\n')) - return + if ssl_req: + if not req.env.get('HTTPS'): + bail(_('ssl required\n')) + return + proto = 'https' + else: + proto = 'http' # do not allow push unless explicitly allowed if not self.check_perm(req, 'push', False): @@ -952,7 +956,9 @@ sys.stdout = cStringIO.StringIO() try: - ret = self.repo.addchangegroup(fp, 'serve') + url = 'remote:%s:%s' % (proto, + req.env.get('REMOTE_HOST', '')) + ret = self.repo.addchangegroup(fp, 'serve', url) finally: val = sys.stdout.getvalue() sys.stdout = old_stdout