[PATCH 1 of 2] hgweb: escape REMOTE_HOST when passing url for addchangegroup
Henrik Stuart
hg at hstuart.dk
Sun Jun 7 14:59:04 CDT 2009
# HG changeset patch
# User Henrik Stuart <hg at hstuart.dk>
# Date 1244398537 -7200
# Node ID 84fc4bb05614318b46863fb20c87f3b4cc9f4c82
# Parent 6e41d3c5619f3d981f7c444a0f01619cb10932fd
hgweb: escape REMOTE_HOST when passing url for addchangegroup
If DNS lookups are turned off on the web server, REMOTE_HOST may be
populated with REMOTE_ADDR, which, if the remote is an IPv6 hosts will
contain colons, thus interfering with the separator character. This is
solved by URL quoting the REMOTE_HOST string.
diff -r 6e41d3c5619f -r 84fc4bb05614 mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py Sat Jun 06 15:38:03 2009 -0700
+++ b/mercurial/hgweb/protocol.py Sun Jun 07 20:15:37 2009 +0200
@@ -163,7 +163,8 @@
try:
url = 'remote:%s:%s' % (proto,
- req.env.get('REMOTE_HOST', ''))
+ urllib.quote(
+ req.env.get('REMOTE_HOST', '')))
try:
ret = repo.addchangegroup(gen, 'serve', url)
except util.Abort, inst:
More information about the Mercurial-devel
mailing list