comparison mercurial/hgweb/protocol.py @ 8846:b30775386d40

acl: support for getting authenticated user from web server (issue298) Previously, the acl extension just read the current system user, which is fine for direct file system access and SSH, but will not work for HTTP(S) as that would return the web server process user identity rather than the authenticated user. An empty user is returned if the user is not authenticated.
author Henrik Stuart <hg@hstuart.dk>
date Sun, 07 Jun 2009 20:31:38 +0200
parents 296767acbb55
children 061eeb602354
comparison
equal deleted inserted replaced
8845:296767acbb55 8846:b30775386d40
160 160
161 oldio = sys.stdout, sys.stderr 161 oldio = sys.stdout, sys.stderr
162 sys.stderr = sys.stdout = cStringIO.StringIO() 162 sys.stderr = sys.stdout = cStringIO.StringIO()
163 163
164 try: 164 try:
165 url = 'remote:%s:%s' % (proto, 165 url = 'remote:%s:%s:%s' % (
166 urllib.quote( 166 proto,
167 req.env.get('REMOTE_HOST', ''))) 167 urllib.quote(req.env.get('REMOTE_HOST', '')),
168 urllib.quote(req.env.get('REMOTE_USER', '')))
168 try: 169 try:
169 ret = repo.addchangegroup(gen, 'serve', url) 170 ret = repo.addchangegroup(gen, 'serve', url)
170 except util.Abort, inst: 171 except util.Abort, inst:
171 sys.stdout.write("abort: %s\n" % inst) 172 sys.stdout.write("abort: %s\n" % inst)
172 ret = 0 173 ret = 0