hgweb Odd-string length error

Jérôme Godbout jerome at bodycad.com
Wed Jul 9 19:31:23 UTC 2014


I got the same result if I remove the virtualhost and just a ScriptAlias
into Apache (just loose the images loading):

ScriptAlias /hg/ "C:/Program Files (x86)/Apache Software
Foundation/Apache2.2/cgi-bin/hgweb.cgi/"

<Directory "C:/Program Files (x86)/Apache Software
Foundation/Apache2.2/cgi-bin/">
Order allow,deny
Allow from all
AllowOverride All
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
</Directory>

Even If I try to use the root directory directly and set into config empty
baseurl=
ScriptAlias / "C:/Program Files (x86)/Apache Software
Foundation/Apache2.2/cgi-bin/hgweb.cgi/"

same result, Odd-length string. Is there any incompatibility between some
python version and mercurial packages?!? everything point into that
direction, cause the ScriptAlias to root directory is pretty stright foward
into apache. Anybody have a working set of Python-mercurial installation
with Apache 2.2 under windows (I wish I could just do it under Linux but I
can't for this).


On Wed, Jul 9, 2014 at 3:11 PM, Jérôme Godbout <jerome at bodycad.com> wrote:

> Apache does not give me any error into it's log (easy to find I set up the
> error and the vhost error log, both are empty of error, some debug info).
> The Error log show nothing (even apache into debug error level). The
> access info show:
> 10.1.x.x - - [09/Jul/2014:14:38:49 -0400] "GET
> /hg/MyRepos/?cmd=capabilities HTTP/1.1" 200 130
> 10.1.x.x - - [09/Jul/2014:14:38:49 -0400] "GET /hg/MyRepos/?cmd=batch
> HTTP/1.1" 200 1355
>
> Look like a problem with the proxy, anybody have any tips to set this into
> virtual host for Apache (see first email for all config info)? Why can I
> browse it and trace graph into the web page of the repos then?
> If I set the hgweb into a virtual host for apache, does I have to set
> something special into the hgweb.config file like proxy_web or something
> like that? I already set the baseurl and staticurl. Anybody have a good
> page for all the fields for this file?
>
> (btw the allow_pull variable should be = * or = True, seen both on the
> wiki, my guess would be * for all user).
>
> If I try to fet the cmd manually by url
> http://myserver/hg/MyRepos/?cmd=batch
> I get the following if this can help:
> ____________________________________
>
> --> --> -->
>
> *<type 'exceptions.KeyError'>* Python 2.7: C:\Python27_32\python.exe
> Wed Jul 09 14:40:23 2014
>
> A problem occurred in a Python script. Here is the sequence of function
> calls leading up to the error, in the order they occurred.
>  C:\Program Files (x86)\Apache Software
> Foundation\Apache2.2\cgi-bin\hgweb.cgi in ()     18
>  from mercurial import demandimport; demandimport.enable()
>      19 from mercurial.hgweb import hgweb
>      20 from flup.server.cgi import WSGIServer
>      21 application = hgweb(config)
> =>   22 WSGIServer(application).run()
> *WSGIServer* = <class 'flup.server.cgi.WSGIServer'>, *application* =
> <mercurial.hgweb.hgwebdir_mod.hgwebdir object>, ).*run* = <bound method
> hgwebdir.run of <mercurial.hgweb.hgwebdir_mod.hgwebdir object>>
> C:\Python27_32\lib\site-packages\flup-1.0.3.dev_20110405-py2.7.egg\flup\server\cgi.py
>  in *run*(self=<flup.server.cgi.WSGIServer object>)      60
>              return write
>      61
> =>   62         result = self.application(environ, start_response)
>      63         try:
>      64             for data in result:
> result *undefined*, *self* = <flup.server.cgi.WSGIServer object>, self.
> *application* = <mercurial.hgweb.hgwebdir_mod.hgwebdir object>, *environ* =
> {'COMSPEC': r'C:\Windows\system32\cmd.exe', 'DOCUMENT_ROOT': 'C:/Program
> Files (x86)/Apache Software Foundation/Apache2.2/htdocs',
> 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT':
> 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
> 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch', 'HTTP_ACCEPT_LANGUAGE':
> 'en-US,en;q=0.8,fr-CA;q=0.6,fr;q=0.4', 'HTTP_CONNECTION': 'keep-alive',
> 'HTTP_COOKIE': 'JSESSIONID.70149e26=1spmkqfvxv6w71gkrm88jx4db8;
> ...ns-timestamper=elapsed; hudson_auto_refresh=false', 'HTTP_HOST':
> 'build_server', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64)
> AppleWebKit/...L, like Gecko) Chrome/35.0.1916.153 Safari/537.36', ...},
> *start_response* = <function start_response>
> C:\Python27_32\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py in
> *__call__*(self=<mercurial.hgweb.hgwebdir_mod.hgwebdir object>,
> env={'COMSPEC': r'C:\Windows\system32\cmd.exe', 'DOCUMENT_ROOT':
> 'C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs',
> 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT':
> 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
> 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch', 'HTTP_ACCEPT_LANGUAGE':
> 'en-US,en;q=0.8,fr-CA;q=0.6,fr;q=0.4', 'HTTP_CONNECTION': 'keep-alive',
> 'HTTP_COOKIE': 'JSESSIONID.70149e26=1spmkqfvxv6w71gkrm88jx4db8;
> ...ns-timestamper=elapsed; hudson_auto_refresh=false', 'HTTP_HOST':
> 'build_server', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64)
> AppleWebKit/...L, like Gecko) Chrome/35.0.1916.153 Safari/537.36', ...},
> respond=<function start_response>)     151
>      def __call__(self, env, respond):
>     152         req = wsgirequest(env, respond)
> =>  153         return self.run_wsgi(req)
>     154
>     155     def read_allowed(self, ui, req):
> *self* = <mercurial.hgweb.hgwebdir_mod.hgwebdir object>, self.*run_wsgi* =
> <bound method hgwebdir.run_wsgi of <mercurial.hgweb.hgwebdir_mod.hgwebdir
> object>>, *req* = <mercurial.hgweb.request.wsgirequest object>
> C:\Python27_32\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py in
> *run_wsgi*(self=<mercurial.hgweb.hgwebdir_mod.hgwebdir object>,
> req=<mercurial.hgweb.request.wsgirequest object>)     216
>                          try:
>     217                             repo = hg.repository(self.ui, real)
> =>  218                             return hgweb(repo).run_wsgi(req)
>     219                         except IOError, inst:
>     220                             msg = inst.strerror
> *global* *hgweb* = <class 'mercurial.hgweb.hgweb_mod.hgweb'>, *repo* =
> <mercurial.localrepo.proxycls object>, ).run_wsgi *undefined*, *req* =
> <mercurial.hgweb.request.wsgirequest object>
> C:\Python27_32\lib\site-packages\mercurial\hgweb\hgweb_mod.py in
> *run_wsgi*(self=<mercurial.hgweb.hgweb_mod.hgweb object>,
> req=<mercurial.hgweb.request.wsgirequest object>)     170
>                  if cmd in perms:
>     171                     self.check_perm(req, perms[cmd])
> =>  172                 return protocol.call(self.repo, req, cmd)
>     173             except ErrorResponse, inst:
>     174
>                  # A client that sends unbundle without 100-continue will
> *global* *protocol* = <module 'mercurial.hgweb.protocol' from
> 'C:\Pyth...\lib\site-packages\mercurial\hgweb\protocol.pyc'>, protocol.
> *call* = <function call>, *self* = <mercurial.hgweb.hgweb_mod.hgweb
> object>, self.*repo* = <mercurial.localrepo.proxycls object>, *req* =
> <mercurial.hgweb.request.wsgirequest object>, *cmd* = 'batch'
> C:\Python27_32\lib\site-packages\mercurial\hgweb\protocol.py in *call*(repo=<mercurial.localrepo.proxycls
> object>, req=<mercurial.hgweb.request.wsgirequest object>, cmd='batch')
>    74 def call(repo, req, cmd):
>      75     p = webproto(req, repo.ui)
> =>   76     rsp = wireproto.dispatch(repo, p, cmd)
>      77     if isinstance(rsp, str):
>      78         req.respond(HTTP_OK, HGTYPE, body=rsp)
> rsp *undefined*, *global* *wireproto* = <module 'mercurial.wireproto'
> from 'C:\Python27_32\lib\site-packages\mercurial\wireproto.pyc'>, wireproto.
> *dispatch* = <function dispatch>, *repo* = <mercurial.localrepo.proxycls
> object>, *p* = <mercurial.hgweb.protocol.webproto object>, *cmd* = 'batch'
>  C:\Python27_32\lib\site-packages\mercurial\wireproto.py in *dispatch*(repo=<mercurial.localrepo.proxycls
> object>, proto=<mercurial.hgweb.protocol.webproto object>, command='batch')
>     480     repo = repo.filtered("served")
>     481     func, spec = commands[command]
> =>  482     args = proto.getargs(spec)
>     483     return func(repo, proto, *args)
>     484
> args *undefined*, *proto* = <mercurial.hgweb.protocol.webproto object>,
> proto.*getargs* = <bound method webproto.getargs of
> <mercurial.hgweb.protocol.webproto object>>, *spec* = 'cmds *'
> C:\Python27_32\lib\site-packages\mercurial\hgweb\protocol.py in *getargs*(self=<mercurial.hgweb.protocol.webproto
> object>, args='cmds *')      30                 data['*'] = star
>      31             else:
> =>   32                 data[k] = knownargs[k][0]
>      33         return [data[k] for k in keys]
>      34     def _args(self):
> *data* = {}, *k* = 'cmds', *knownargs* = {'cmd': ['batch']}
>
> *<type 'exceptions.KeyError'>*: 'cmds'
>       args = ('cmds',)
>       message = 'cmds'
>
>
> On Wed, Jul 9, 2014 at 2:32 PM, Matt Mackall <mpm at selenic.com> wrote:
>
>> On Mon, 2014-07-07 at 11:53 -0400, Jérôme Godbout wrote:
>> > Hi,
>> > I'm trying to setup a hgweb server with Apache 2.2 (32 bits) under
>> Windows
>> > 7 (64bits). I got it to serve and can browse the file at
>> > my http://build_server/hg/MainRepos properly. I can see the file, the
>> > branch, the graph, the images are loading, etc. But I cannot
>> > pull from the same address, I always end up with the following error:
>> > "Odd-string length" into wireproto.py
>> >
>> > Here's an example of error message with TortoiseHg (it's most verbatim
>> then
>> > the command line):
>> > #########################################
>> >     #!python
>> >     ** Mercurial version (3.0.1).  TortoiseHg version (3.0.1)
>> >     ** Command: --nofork workbench
>> >     ** CWD: F:\MainRepos
>> >     ** Encoding: cp1252
>> >     ** Extensions loaded:
>> >     ** Python version: 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC
>> v.1500
>> > 64 bit (AMD64)]
>> >     ** Windows version: sys.getwindowsversion(major=6, minor=1,
>> build=7601,
>> > platform=2, service_pack='Service Pack 1')
>> >     ** Processor architecture: x64
>> >     ** Qt-4.8.5 PyQt-4.10.3 QScintilla-2.7.2
>> >     Traceback (most recent call last):
>> >       File "tortoisehg\hgqt\thread.pyo", line 304, in run
>> >       File "tortoisehg\util\hglib.pyo", line 710, in dispatch
>> >       File "mercurial\dispatch.pyo", line 819, in _dispatch
>> >       File "mercurial\dispatch.pyo", line 599, in runcommand
>> >       File "mercurial\dispatch.pyo", line 910, in _runcommand
>> >       File "mercurial\dispatch.pyo", line 881, in checkargs
>> >       File "mercurial\dispatch.pyo", line 816, in <lambda>
>> >       File "mercurial\util.pyo", line 518, in check
>> >       File "mercurial\commands.pyo", line 4607, in pull
>> >       File "mercurial\localrepo.pyo", line 1708, in pull
>> >       File "mercurial\exchange.pyo", line 539, in pull
>> >       File "mercurial\exchange.pyo", line 564, in _pulldiscovery
>> >       File "mercurial\discovery.pyo", line 46, in findcommonincoming
>> >       File "mercurial\setdiscovery.pyo", line 140, in findcommonheads
>> >       File "mercurial\wireproto.pyo", line 123, in submit
>> >       File "mercurial\wireproto.pyo", line 129, in _submitreq
>> >       File "mercurial\wireproto.pyo", line 226, in heads
>> >       File "mercurial\wireproto.pyo", line 171, in decodelist
>> >     TypeError: Odd-length string
>> > ########################################
>>
>> Almost certainly a server error. Check your server's _error_ logs (as
>> you're on Windows, they'll be in a hard-to-find place that's not your
>> access logs).
>>
>> --
>> Mathematics is the supreme nostalgia of our time.
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20140709/4b04251f/attachment-0002.html>


More information about the Mercurial mailing list