Issue1171

Title hgweb - url encoding issues
Priority bug Status resolved
Superseder Nosy List djc, dsouza
Assigned To djc Topics hgweb

Created on 2008-06-09.16:59:04 by dsouza, last changed 2008-11-07.07:48:14 by djc.

Files
File name Uploaded Type Edit Remove
hgrc dsouza, 2008-06-09.16:59:03 text/plain
paje.cgi dsouza, 2008-06-09.16:59:14 text/plain
Messages
msg7861 (view) Author: djc Date: 2008-11-07.07:48:13
I just did, thanks for testing!
msg7859 (view) Author: dsouza Date: 2008-11-07.02:41:21
Hi,

I just did it (version d1dff8c492dd) and it worked fine :-)

Thanks a lot,

PS: Should i mark this as fixed or you dot it?
msg7856 (view) Author: djc Date: 2008-11-06.12:40:13
Yeah... can you try this with a snapshot from the mercurial crew repo?
msg7855 (view) Author: dsouza Date: 2008-11-06.12:24:32
Hi,

sorry I did not see your messages until now. I'm using it as follows:
$ cat /etc/apache/sites-available/projects
<VirtualHost *:80>
        ServerAdmin root@bitforest.org
        ServerName projects.bitforest.org
        DocumentRoot /var/www/projects

        AddDefaultCharset utf-8

        AddHandler python-program .py
        <Directory /var/www/projects/>
                DirectoryIndex index.cgi
                AddHandler cgi-script .cgi
                Options ExecCGI FollowSymLinks
        </Directory>
</VirtualHost>

$ cat /var/www/projects/ccw.cgi 
#!/usr/bin/env python
#
# An example CGI script to use hgweb, edit as necessary

# adjust python path if not a system-wide install:
#import sys
#sys.path.insert(0, "/path/to/python/lib")

# enable importing on demand to reduce startup time
from mercurial import demandimport; demandimport.enable()

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

# If you'd like to serve pages with UTF-8 instead of your default
# locale charset, you can do so by uncommenting the following lines.
# Note that this will cause your .hgrc files to be interpreted in
# UTF-8 and all your repo files to be displayed using UTF-8.
#
#import os
#os.environ["HGENCODING"] = "UTF-8"

from mercurial.hgweb.hgweb_mod import hgweb
from mercurial.hgweb.request import wsgiapplication
import mercurial.hgweb.wsgicgi as wsgicgi

def make_web_app():
    return hgweb("/home/mercurial/projects/ccw", "ccw")

wsgicgi.launch(wsgiapplication(make_web_app))

You can see an live example:
http://projects.bitforest.org/ccw.cgi?file/b792f3a35b73/src/main/
msg7826 (view) Author: djc Date: 2008-11-03.20:37:43
I can't reproduce this with latest crew (with hg serve). Is this with CGI's
only? I'd appreciate if you can test this. I used this to test:

echo % setting up repo
hg init test
cd test
mkdir c++
echo a > c++/a
hg ci -Ama
msg6238 (view) Author: dsouza Date: 2008-06-09.18:32:12
Nice! Also thanks for the prompt response.
msg6237 (view) Author: djc Date: 2008-06-09.17:41:27
Ah, ugly stuff. I should fix this.
msg6236 (view) Author: dsouza Date: 2008-06-09.17:04:20
When the repository directory contains characters that could be encoded by an 
url encoding procedure, the links doesn't work. For instance, 
I have a respository with the following path:
--> HGROOT/src/main/c++/

All links to this directory (and files under it) encodes the + character, so I 
endup with an URL similiar to this:
http://<host>/paje.cgi?file/3ed29fbed797/src/main/c%2B%2B/

And this returns a 404 error (changing to + characters works btw).
History
Date User Action Args
2008-11-07 07:48:14djcsetstatus: need-eg -> resolved
messages: + msg7861
2008-11-07 02:41:21dsouzasetmessages: + msg7859
2008-11-06 12:40:14djcsetmessages: + msg7856
2008-11-06 12:24:34dsouzasetmessages: + msg7855
2008-11-03 20:37:44djcsetstatus: chatting -> need-eg
messages: + msg7826
2008-09-09 09:43:31djcsetassignedto: djc
2008-09-07 16:31:05tonfasettopic: + hgweb
2008-06-09 18:32:15dsouzasetmessages: + msg6238
2008-06-09 17:41:28djcsetnosy: + djc
messages: + msg6237
2008-06-09 17:04:30dsouzasetmessages: - msg6235
2008-06-09 17:04:20dsouzasetstatus: unread -> chatting
messages: + msg6236
2008-06-09 16:59:14dsouzasetfiles: + paje.cgi
2008-06-09 16:59:04dsouzacreate