Description

Using X-Moin-Location to specify the site location, along with ModRewrite, can be broken by a patch labeled in the code as sometimes needed for ModPython.

Steps to reproduce

  1. Setup a ReWriteRule to take the ".cgi" off of the cgi-script used to execute MoinMoin.

  2. Setup a RequestHeader so that generated links will also not have the .cgi extension

Example

in .htaccess

ReWriteEngine on
ReWriteRule ^moin(/.*)? moin.cgi$1
RequestHeader set X-Moin-Location /moin/

Details

Around line 506 of request.py, there is the code

         # This may happen when using mod_python
         if scriptAndPath.startswith(location):
             self.path_info = scriptAndPath[len(location):]

If the location (specified by the X-Moin-Location header) is a leading subset of scriptAndPath (the actual CGI script), then this code clobbers the the path_info. Instead of a script of moin.cgi and a path_info of FrontPage, we get a script of moin and a path_info of .cgi/FrontPage.

MoinMoin Version

1.5.6

OS and Version

Linux 2.4.32 (Debian)

Python Version

2.3.5

Server Setup

Apache with CGI

Server Details

wikifarm

Language you are using the wiki in (set in the browser/UserPreferences)

English

Workaround

Comment out these lines of code.

Another possibility might be to have the public script name and the actual script name start differently.

Discussion

(!) To remove that mod_python related hack, we need some moin users trying to run it without those 2 lines in request.py and report back here about success.


Does anyone know what problem this hack was intended to solve? Perhaps some other patch can be developed that takes into account the special nature of the '/' character. Perhaps something like

         # This may happen when using mod_python
         if scriptAndPath.startswith(location) && scriptAndPath[len(location)] == "/":
             self.path_info = scriptAndPath[len(location):]

(Sorry for any syntax errors; my python is a bit rusty.)

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/SiteLocationBrokenByModPythonPatch (last edited 2007-10-29 19:12:42 by localhost)