[issue2736] hgwebdir: REMOTE_USER is None
Gottox
bugs at mercurial.selenic.com
Mon Mar 28 22:25:37 UTC 2011
New submission from Gottox <g at s01.de>:
- Configuration
I'm using mercurial 1.7 on a Gentoo box. I'm running Apache/2.2.16 with WSGI
and try to setup a hgwebdir with simple htpasswd authentication and
restricted read/push configuration.
I created a test repository with deny_read = * and allow_read = someuser as
well as deny_push = * and allow_push = someuser. The user exists in
htpasswd.
- What happens?
I'm able to login with the credentials of someuser, but no repository is
shown. I can workaround the behavior by replacing the deny_* and allow_* by
allow_read = * and allow_push = *. With this changes I'm able to read and
push again. So it seems to be no problem about unix privileges.
- Debugging
I added some debug output to read_allowed in /usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py to make it talky:
114 if user is allowed to read the repo, else return False."""
115 import traceback
116
117
118 user = req.env.get('REMOTE_USER')
119 print user
120 traceback.print_stack()
121 print req.env
122
I noticed some strange behavior, that REMOTE_USER is not set, if I try to
access hg.host.local/test:
-------- snip --------
[Tue Mar 29 00:15:22 2011] [error] None
--- Comment: Above should be "someuser", not None
[Tue Mar 29 00:15:22 2011] [error] File "/var/www/smjg.org/hg/hgweb.wsgi",
line 19, in <module>
[Tue Mar 29 00:15:22 2011] [error] wsgicgi.launch(application)
[Tue Mar 29 00:15:22 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/wsgicgi.py", line 73, in launch
[Tue Mar 29 00:15:22 2011] [error] for chunk in content:
[Tue Mar 29 00:15:22 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/util.py", line 244, in increasingchunks
[Tue Mar 29 00:15:22 2011] [error] for chunk in source:
[Tue Mar 29 00:15:22 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/templater.py", line 30, in _flatten
[Tue Mar 29 00:15:22 2011] [error] for j in _flatten(i):
[Tue Mar 29 00:15:22 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/templater.py", line 23, in _flatten
[Tue Mar 29 00:15:22 2011] [error] for i in thing:
[Tue Mar 29 00:15:22 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/templater.py", line 103, in _format
[Tue Mar 29 00:15:22 2011] [error] for i in v:
[Tue Mar 29 00:15:22 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py", line 271, in entries
[Tue Mar 29 00:15:22 2011] [error] for row, parity in zip(rows,
paritygen(self.stripecount)):
[Tue Mar 29 00:15:22 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py", line 227, in rawentries
[Tue Mar 29 00:15:22 2011] [error] if not self.read_allowed(u, req):
[Tue Mar 29 00:15:22 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py", line 120, in read_allowed
[Tue Mar 29 00:15:22 2011] [error] traceback.print_stack()
[Tue Mar 29 00:15:22 2011] [error] {'REQUEST_METHOD': 'GET', 'USER': 'root',
'HOME': '/root', 'QUERY_STRING': '', 'PATH':
'/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/bin:/sbin:/us
r/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/lib/subversion/
bin', 'CONSOLETYPE': 'pty', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'SHLVL':
'1', 'wsgi.url_scheme': 'http', 'RC_DEFAULTLEVEL': 'default',
'DEFAULTLEVEL': 'default', 'SOFTLEVEL': 'default', 'wsgi.input': <open file
'<stdin>', mode 'r' at 0x127ba020>, 'wsgi.multithread': False, 'SVCNAME':
'apache2', '_': '/usr/sbin/apache2', 'wsgi.version': (1, 0),
'wsgi.run_once': True, 'wsgi.errors': <mod_wsgi.Log object at 0x1282e908>,
'wsgi.multiprocess': True, 'PWD': '/var/hg', 'BOOTLEVEL': 'boot',
'RC_RUNLEVEL': 'default', 'RC_BOOTLEVEL': 'boot', 'PATH_INFO': ''}
[Tue Mar 29 00:15:22 2011] [error] Status: 200 Script output follows\r
[Tue Mar 29 00:15:22 2011] [error] Content-Type: text/html; charset=ascii\r
[Tue Mar 29 00:15:22 2011] [error] \r
[Tue Mar 29 00:15:22 2011] [error]
...
[Tue Mar 29 00:15:22 2011] [error] </body>
[Tue Mar 29 00:15:22 2011] [error] </html>
[Tue Mar 29 00:15:22 2011] [error]
-------- snap --------
On the other hand, if I call the repository index, at some point the User is
correct, but still, no repository to see.
-------- snip --------
[Tue Mar 29 00:17:06 2011] [error] someuser
[Tue Mar 29 00:17:06 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/util.py", line 244, in increasingchunks
[Tue Mar 29 00:17:06 2011] [error] for chunk in source:
[Tue Mar 29 00:17:06 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/templater.py", line 30, in _flatten
[Tue Mar 29 00:17:06 2011] [error] for j in _flatten(i):
[Tue Mar 29 00:17:06 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/templater.py", line 23, in _flatten
[Tue Mar 29 00:17:06 2011] [error] for i in thing:
[Tue Mar 29 00:17:06 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/templater.py", line 103, in _format
[Tue Mar 29 00:17:06 2011] [error] for i in v:
[Tue Mar 29 00:17:06 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py", line 271, in entries
[Tue Mar 29 00:17:06 2011] [error] for row, parity in zip(rows,
paritygen(self.stripecount)):
[Tue Mar 29 00:17:06 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py", line 227, in rawentries
[Tue Mar 29 00:17:06 2011] [error] if not self.read_allowed(u, req):
[Tue Mar 29 00:17:06 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py", line 120, in read_allowed
[Tue Mar 29 00:17:06 2011] [error] traceback.print_stack()
[Tue Mar 29 00:17:06 2011] [error] {'AUTH_TYPE': 'Basic',
'mod_wsgi.listener_port': '443', 'HTTP_COOKIE':
'__utma=175012768.1406765705.1292399435.1301343253.1301347070.400;
__utmc=175012768; phpbb3_5zkjz_sid=1ea1fdcbf06779e7a4c2dfde6846ab2d;
phpbb3_5zkjz_k=ab9a71d8cc9c81b8; phpbb3_5zkjz_u=1432;
__utmz=175012768.1294489209.5.2.utmccn=(organic)|utmcsr=google|utmctr=jugend
organisationen%20bdsm|utmcmd=organic', 'mod_wsgi.listener_host': '',
'SERVER_SOFTWARE': 'Apache', 'SCRIPT_NAME': '', 'mod_wsgi.handler_script':
'', 'SERVER_SIGNATURE': '<address>Apache Server at hg.smjg.org Port
443</address>\\n', 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/',
'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': '', 'SSL_TLS_SNI':
'hg.smjg.org', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X
10_6_7; de-de) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4
Safari/533.20.27', 'HTTP_CONNECTION': 'keep-alive', 'SERVER_NAME':
'hg.smjg.org', 'REMOTE_ADDR': '87.154.231.175', 'mod_wsgi.request_handler':
'wsgi-script', 'wsgi.url_scheme': 'https', 'PATH_TRANSLATED':
'/var/www/smjg.org/hg/hgweb.wsgi/', 'SERVER_PORT': '443',
'wsgi.multiprocess': True, 'mod_wsgi.input_chunked': '0', 'SERVER_ADDR':
'85.214.19.69', 'DOCUMENT_ROOT': '/var/www/smjg.org/hg/htdocs',
'mod_wsgi.process_group': '', 'SCRIPT_FILENAME':
'/var/www/smjg.org/hg/hgweb.wsgi', 'SERVER_ADMIN': '[no address given]',
'wsgi.input': <mod_wsgi.Input object at 0x12a67de0>, 'REMOTE_USER':
'someuser', 'HTTP_HOST': 'hg.smjg.org', 'HTTPS': '1', 'wsgi.multithread':
False, 'mod_wsgi.callable_object': 'application', 'REQUEST_URI': '/',
'HTTP_ACCEPT':
'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,imag
e/png,*/*;q=0.5', 'wsgi.version': (1, 1), 'GATEWAY_INTERFACE': 'CGI/1.1',
'wsgi.run_once': False, 'wsgi.errors': <mod_wsgi.Log object at 0x12a61818>,
'REMOTE_PORT': '63472', 'HTTP_ACCEPT_LANGUAGE': 'de-de', 'mod_wsgi.version':
(3, 3), 'mod_wsgi.application_group': 'hg.smjg.org|',
'mod_wsgi.script_reloading': '1', 'wsgi.file_wrapper': <built-in method
file_wrapper of mod_wsgi.Adapter object at 0x12a920f8>,
'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'UNIQUE_ID':
'TZEI4n8AAAEAABiml2UAAAAC'}
[Tue Mar 29 00:17:07 2011] [error] None
--- Comment: Above should be "someuser", not None
[Tue Mar 29 00:17:07 2011] [error] File "/var/www/smjg.org/hg/hgweb.wsgi",
line 19, in <module>
[Tue Mar 29 00:17:07 2011] [error] wsgicgi.launch(application)
[Tue Mar 29 00:17:07 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/wsgicgi.py", line 73, in launch
[Tue Mar 29 00:17:07 2011] [error] for chunk in content:
[Tue Mar 29 00:17:07 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/util.py", line 244, in increasingchunks
[Tue Mar 29 00:17:07 2011] [error] for chunk in source:
[Tue Mar 29 00:17:07 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/templater.py", line 30, in _flatten
[Tue Mar 29 00:17:07 2011] [error] for j in _flatten(i):
[Tue Mar 29 00:17:07 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/templater.py", line 23, in _flatten
[Tue Mar 29 00:17:07 2011] [error] for i in thing:
[Tue Mar 29 00:17:07 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/templater.py", line 103, in _format
[Tue Mar 29 00:17:07 2011] [error] for i in v:
[Tue Mar 29 00:17:07 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py", line 271, in entries
[Tue Mar 29 00:17:07 2011] [error] for row, parity in zip(rows,
paritygen(self.stripecount)):
[Tue Mar 29 00:17:07 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py", line 227, in rawentries
[Tue Mar 29 00:17:07 2011] [error] if not self.read_allowed(u, req):
[Tue Mar 29 00:17:07 2011] [error] File "/usr/lib/python2.6/site-
packages/mercurial/hgweb/hgwebdir_mod.py", line 120, in read_allowed
[Tue Mar 29 00:17:07 2011] [error] traceback.print_stack()
[Tue Mar 29 00:17:07 2011] [error] {'REQUEST_METHOD': 'GET', 'USER': 'root',
'HOME': '/root', 'QUERY_STRING': '', 'PATH':
'/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/bin:/sbin:/us
r/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/lib/subversion/
bin', 'CONSOLETYPE': 'pty', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'SHLVL':
'1', 'wsgi.url_scheme': 'http', 'RC_DEFAULTLEVEL': 'default',
'DEFAULTLEVEL': 'default', 'SOFTLEVEL': 'default', 'wsgi.input': <open file
'<stdin>', mode 'r' at 0x127ba020>, 'wsgi.multithread': False, 'SVCNAME':
'apache2', '_': '/usr/sbin/apache2', 'wsgi.version': (1, 0),
'wsgi.run_once': True, 'wsgi.errors': <mod_wsgi.Log object at 0x1282e908>,
'wsgi.multiprocess': True, 'PWD': '/var/hg', 'BOOTLEVEL': 'boot',
'RC_RUNLEVEL': 'default', 'RC_BOOTLEVEL': 'boot', 'PATH_INFO': ''}
[Tue Mar 29 00:17:07 2011] [error] Status: 200 Script output follows\r
[Tue Mar 29 00:17:07 2011] [error] Content-Type: text/html; charset=ascii\r
[Tue Mar 29 00:17:07 2011] [error] \r
[Tue Mar 29 00:17:07 2011] [error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
[Tue Mar 29 00:17:07 2011] [error] <html
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
...
[Tue Mar 29 00:17:07 2011] [error] </body>
[Tue Mar 29 00:17:07 2011] [error] </html>
[Tue Mar 29 00:17:07 2011] [error]
-------- snap --------
----------
messages: 15870
nosy: Gottox
priority: bug
status: unread
title: hgwebdir: REMOTE_USER is None
____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2736>
____________________________________________________
More information about the Mercurial-devel
mailing list