[PATCH] Defined REQUEST_URI on Microsoft IIS servers

Ezra.Smith at bentley.com Ezra.Smith at bentley.com
Wed Oct 31 14:41:26 UTC 2007


I put this patch in a larger post on the general list a week or so ago.
Here's the actual patch on its own via "hg export". Without defining
REQUEST_URI, a Microsoft IIS server won't be able to host a mercurial
repository using CGI.

-Ezra
====================================

# HG changeset patch
# User Ezra Smith <ezra.smith at bentley.com>
# Date 1193841248 14400
# Node ID ab23db2972325313ac86588b834eb9e630ec44b3
# Parent  3aa5c45874c60560d75df74adbc964e107c8538a
Defined the REQUEST_URI environment variable on Microsoft IIS
web servers, which do not have it defined by default.

diff -r 3aa5c45874c6 -r ab23db297232 mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	Sat Oct 20 03:04:34 2007 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Oct 31 10:34:08 2007 -0400
@@ -87,6 +87,11 @@ class hgwebdir(object):
 
         def config(section, name, default=None, untrusted=True):
             return parentui.config(section, name, default, untrusted)
+
+        if (req.env['SERVER_SOFTWARE'].split('/')[0] ==
'Microsoft-IIS'):
+            iis_scriptname = req.env['SCRIPT_NAME']
+            iis_pathinfo = req.env['PATH_INFO']
+            req.env['REQUEST_URI'] = req.env['PATH_INFO'] =
iis_pathinfo[len(iis_scriptname):]
 
         url = req.env['REQUEST_URI'].split('?')[0]
         if not url.endswith('/'):




More information about the Mercurial-devel mailing list