hgweb Odd-string length error

Jérôme Godbout jerome at bodycad.com
Mon Jul 7 15:53:10 UTC 2014


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
########################################

Apache was taken as binary install from the web site
http://httpd.apache.org/download.cgi
I have try Python 2.7 64 bits and 32 bits with the same result
https://www.python.org/download/windows/
I have install mercurial 3.0.1 into Python with the python specific
installer: http://mercurial.selenic.com/wiki/Download

I'm starting with cgi script for now (want to move to wsgi or fcgi later
when got this working first). Here's my hgweb.cgi
##########################################
#!C:/Python27_32/python.exe

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "C:/Program Files (x86)/Apache Software
Foundation/Apache2.2/hgweb/hgserve.config"

# Uncomment and adjust if Mercurial is not installed system-wide:
import sys; sys.path.insert(0, "c:/Python27_32/lib")

# Force windows encoding
#import os;
#os.environ["HGENCODING"] = "utf-8"
#os.environ["HGENCODING"] = "windows-1251"
#os.environ["HGENCODING"] = "cp1252"

# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb
from flup.server.cgi import WSGIServer
application = hgweb(config)
WSGIServer(application).run()
##########################################

My hgserve.config
##########################################
[paths]
MainRepos = \\10.1.1.2\share\MainRepos\**

[web]
description = Main Repos
allow_archive = zip
descend = True
collapse = True
push_ssl = False
allow_push = *
allow_pull = True
allow_read = *
#encoding = utf-8
#encoding = windows-1251
#encoding = cp1251
#encoding = cp1252
baseurl = /hg
staticurl = /hg/static
verbose = False
##########################################

My apache httpd.conf modification
##########################################
<VirtualHost *:80>
ServerName build_server
RewriteEngine on
ProxyRequests off
        LimitRequestLine 32760
        RewriteRule ^/hg$ http://build_server/hg/ [R] [L]
AliasMatch ^/hg/static/(.*)
"C:/Python27_32/Lib/site-packages/mercurial/templates/static/$1"
ScriptAliasMatch ^/hg/(.*) "C:/Program Files (x86)/Apache Software
Foundation/Apache2.2/cgi-bin/hgweb.cgi/$1"
ProxyPassReverse /hg "C:/Program Files (x86)/Apache Software
Foundation/Apache2.2/cgi-bin/hgweb.cgi/"

        # Enable access to static folder for hgweb
<Directory "C:/Python27_32/Lib/site-packages/mercurial/templates/static/">
Order allow,deny
Allow from all
AllowOverride All
</Directory>
 # Enable execution of cgi-bin scripts
<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
#AddDefaultCharset WINDOWS-1251
#AddDefaultCharset UTF-8
#AddDefaultCharset cp1252
</Directory>
</VirtualHost>
##########################################

As you can see into the config, I try to play with the encoding to see it
it was the problems (cp1252 vs utf-8), without any luck. My repos is in
windows default cp1252.

I'm a bit lost about what is giving this error!?! If anybody have an idea,
that would be apprciated, thanks,
Jerome Godbout
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20140707/5b3b73f8/attachment-0002.html>


More information about the Mercurial mailing list