Description

When trying to edit a new page (i.e. one that does not yet exist), a "404 Page not found" is shown.

Steps to reproduce

  1. Run MoinMoin 1.5.2 with IIS 5

  2. On an arbitrary page, create some WikiName that does not yet exist, e.g. ThisDoesNotYetExist

  3. Try to edit the new (not yet existing page)

Example

Details

MoinMoin Version

1.5.2

OS and Version

Windows 2000 Server SP4

Python Version

2.4.2

Server Setup

IIS 5

Server Details

python.exe as ISAPI-CGI

Using PyDEV remote debugger I was able to identify a code sequence within Page.py / Page.send_page that will send a 404 status header for any page that does not yet exist. IIS will in turn by default send its own error page and disallow any further writes to the response, eventually causing an IO Error 22 exception (that won't show, as IE will block MoinMoin's error page as well).

I don't understand, why a 404 (not found) status should be returned in the first place, when in fact there will be a page (the new one), at least most of the time.

These are the lines within Page.send_page I deemed to be suspectable:

   1             if page_exists:
   2                 if not request.cacheable or request.user.valid:
   3                     request.http_headers(request.nocache)
   4                 else:
   5                     # use the correct last-modified value from the on-disk file
   6                     # to ensure cacheability where supported
   7                     request.http_headers(["Last-Modified: " +
   8                          formathttpdate(os.path.getmtime(self._text_filename()))])
   9 
  10             else:
  11                 request.http_headers(['Status: 404 NOTFOUND'])
  12                 request.setResponseCode(404)

Workaround

HelpOnInstalling/InternetInformationServer suggests to change IIS settings, so that it will not send an error page for 404

For me, just removing the 404 worked like a charm:

   1             if page_exists:
   2                 if not request.cacheable or request.user.valid:
   3                     request.http_headers(request.nocache)
   4                 else:
   5                     # use the correct last-modified value from the on-disk file
   6                     # to ensure cacheability where supported
   7                     request.http_headers(["Last-Modified: " +
   8                          formathttpdate(os.path.getmtime(self._text_filename()))])
   9 
  10             #rsa else:
  11             #rsa     request.http_headers(['Status: 404 NOTFOUND'])
  12             #rsa     request.setResponseCode(404)

Discussion

This is not a bug. Please refer to HelpOnInstalling/InternetInformationServer and read the hint there about this broken IIS default configuration.

Yep, you're perfectly right. Looking at http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4, it's perfectly legal to send addional data: "The 4xx class of status code is intended for cases in which the client seems to have erred. Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable to any request method. User agents SHOULD display any included entity to the user."

Additional Information:

I'd like to point out that sending the 404 can also create problems when using Apache to serve the pages. Apache and Moin 'correctly' send a 404 and the create-new-page page, but as the page makes its way to the end-user's web browser, something along the way drops the page content. Using Fiddler, I've monitored the request and the response. On my computer in my home, the request goes out and the 404 and the content come back. On someone else's computer at her house, the request goes out and the 404 comes back, but NO content arrives. The browser then displays its built-in 404 error page. I fully agree that whatever is dropping the page content is behaving incorrectly. However, from the perspective of my end user, "the wiki thing" that I want my user to use shows a 404 error and not a create-new-page page.

What could MoinMoin do that would be both 'correct' and also produce the result that the end user desires?

One possibility would be to make the code that is returned on a create-new-page page be configurable in the wikiconfig file.

First bring concrete evidence that such issue exists. What OS the other person runs? what browser and version? how is she connected to the internet? How many people effected by this "issue"?

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/Status404OnNewPage (last edited 2007-10-29 19:11:01 by localhost)