Description
Creating a new page fails when installed on IIS.
NOTE: This is a duplicate, see MoinMoinBugs/CantCreateEmptyPageHostedOnIis
The solution is to reset the behaviour of IIS on 404 errors to default, see HelpOnInstalling/InternetInformationServer, the section starting with "Starting with MoinMoin 1.3.5".
Steps to reproduce
Install MoinMoin on Windows using IIS
- Configure it
- Open the frontpage
Edit the frontpage and add a link to a non-existing page: ["nonexisting page"]
- Save the change
- Click on the new link
- You get an 404 error rather than the option to create the page
Example
see above
Details
This error can be found in the data directory's error.log file:
IOError: [Errno 22] Invalid argument [Fri May 26 12:31:54 2006] IOError: [Errno 22] Invalid argument Traceback (most recent call last): File "C:\moin\icdwiki\moin.cgi", line 43, in ? request.run() File "c:/moin/lib/site-packages\MoinMoin\request.py", line 1129, in run self.fail(err) File "c:/moin/lib/site-packages\MoinMoin\request.py", line 1163, in fail failure.handle(self) File "c:/moin/lib/site-packages\MoinMoin\failure.py", line 145, in handle request.write('<pre>\n') File "c:/moin/lib/site-packages\MoinMoin\request.py", line 1427, in write sys.stdout.write(self.encode(data)) IOError: [Errno 22] Invalid argument
Workaround
I have added the following line to moin.cgi:
## ... from MoinMoin.request import RequestCGI request = RequestCGI() ## added this line sys.stdout.write('bugfix') request.run() ## ...
I have no idea why it works, but it does. Apparently it initializes the standard output somehow. Writing an empty string or a space does not work.
- This breaks the HTTP Header and lets IIS send a 200 response code.
Another workaround is to just return 200 for non-existing wiki pages:
## Page.py: #... # start document output doc_leader = self.formatter.startDocument(self.page_name) page_exists = self.exists() if not content_only: request.setHttpHeader("Content-Type: %s; charset=%s" % ('text/html', config.charset)) if page_exists: #... else: #request.setHttpHeader('Status: 404 NOTFOUND') #request.setResponseCode(404) request.setHttpHeader('Status: 200 OK')
This "200 Hack" is not web standards compliant. If a page is not found, a wiki should send 404 and html content to create a page. The correct solution is to just fix that in the configuration of IIS. If you use this "200 Hack", search engines will believe that the page exists and index the stuff they get. -- ThomasWaldmann 2007-03-30 16:32:25
Discussion
This is not a MoinMoin bug, please refer to the IIS installation instructions for working around this IIS bug.
Plan
- Priority:
- Assigned to:
- Status: