changeset 8845:296767acbb55

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.
author Henrik Stuart <hg@hstuart.dk>
date Sun, 07 Jun 2009 20:15:37 +0200
parents d2ef4f2b904a
children b30775386d40
files mercurial/hgweb/protocol.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/protocol.py	Fri Jun 19 14:00:41 2009 +0200
+++ 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: