[issue1819] cloning a repository served by hg serve fails
Daniel Neugebauer
mercurial-bugs at selenic.com
Mon Aug 31 23:11:13 UTC 2009
New submission from Daniel Neugebauer <energiequant at energiequant.de>:
Using Mercurial 1.3.1's built-in command "hg serve" I can serve a
repository to a browser but hg clients cannot use that instance to clone
from it. The client breaks with "abort: error:" and the server throws an
exception:
----------------------------------------
Exception happened during processing of request from ('192.168.0.203',
49178)
Traceback (most recent call last):
File "/usr/lib64/python2.5/SocketServer.py", line 464, in
process_request_thread
self.finish_request(request, client_address)
File "/usr/lib64/python2.5/SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib64/python2.5/site-packages/mercurial/hgweb/server.py", line
44, in __init__
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kargs)
File "/usr/lib64/python2.5/SocketServer.py", line 522, in __init__
self.handle()
File "/usr/lib64/python2.5/BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "/usr/lib64/python2.5/BaseHTTPServer.py", line 310, in
handle_one_request
method()
File "/usr/lib64/python2.5/site-packages/mercurial/hgweb/server.py", line
76, in do_GET
self.do_POST()
File "/usr/lib64/python2.5/site-packages/mercurial/hgweb/server.py", line
67, in do_POST
self.do_write()
File "/usr/lib64/python2.5/site-packages/mercurial/hgweb/server.py", line
60, in do_write
self.do_hgweb()
File "/usr/lib64/python2.5/site-packages/mercurial/hgweb/server.py", line
124, in do_hgweb
for chunk in self.server.application(env, self._start_response):
File "/usr/lib64/python2.5/site-packages/mercurial/hgweb/hgweb_mod.py",
line 79, in __call__
return self.run_wsgi(req)
File "/usr/lib64/python2.5/site-packages/mercurial/hgweb/hgweb_mod.py",
line 112, in run_wsgi
raise ErrorResponse(HTTP_NOT_FOUND)
ErrorResponse
----------------------------------------
Lines 111 and 112 were introduced for issue 1322:
if query:
raise ErrorResponse(HTTP_NOT_FOUND)
If I comment that out everything works and the received clone verifies
correctly.
My req.env is:
{'SCRIPT_NAME': '',
'REQUEST_METHOD': 'GET',
'PATH_INFO': '/test',
'SERVER_PROTOCOL': 'HTTP/1.1',
'QUERY_STRING':
'pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between',
'HTTP_USER_AGENT': 'mercurial/proto-1.0',
'SERVER_NAME': 'enterprise.federation',
'REMOTE_ADDR': '192.168.0.203',
'wsgi.url_scheme': 'http',
'SERVER_PORT': '8000',
'wsgi.input': <socket._fileobject object at 0x7fe3de2aced8>,
'HTTP_HOST': '192.168.0.2:8000',
'wsgi.multithread': True,
'REQUEST_URI': '/test?
pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between',
'HTTP_ACCEPT': 'application/mercurial-0.1',
'wsgi.version': (1, 0),
'GATEWAY_INTERFACE': 'CGI/1.1',
'wsgi.run_once': 0,
'wsgi.errors': <mercurial.hgweb.server._error_logger object at
0x7fe3de2ad590>,
'wsgi.multiprocess': False,
'CONTENT_TYPE': 'text/plain',
'REMOTE_HOST': '192.168.0.203',
'HTTP_ACCEPT_ENCODING': 'identity'
}
Variable "query" has value 'test'.
I got the exact same issue on Gentoo Linux with Python 2.5.4 and two
machines running OS X 10.5 with Python 2.5.1 (I have not tested Windows).
It does not matter if I try to clone over a network or from localhost.
Disabling extensions (like zeroconf) has no effect either. I did not test
permanent hosting with mod_wsgi or similar.
To me it does not seem "query" could be empty when requesting a repository,
so the condition seems incomplete or misplaced.
Steps to reproduce:
1. change directory to a repository to serve
2. run "hg serve"
3. run "hg clone http://server-ip:8000/reposname" somewhere else
(using a trailing slash won't help either)
----------
messages: 10441
nosy: dneuge
priority: urgent
status: unread
title: cloning a repository served by hg serve fails
____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://mercurial.selenic.com/bts/issue1819>
____________________________________________________
More information about the Mercurial-devel
mailing list