Description

I have a MoinMoin wiki, version 1.2.3, set up with the html2 parser installed (named just html). Someone just notified me that when they save a page of html content (ie. "#format html" at the top), they get an internal server error. Looking at the apache logs, I see

[Mon Oct 18 16:10:02 2004] [error] [client 10.33.63.146] malformed            
header from script. Bad header=<body>:                                        
/home/e-smith/files/ibays/Primary/cgi-bin/moin.cgi

If I remove the body tags, and ensure that the line after the #format directive is blank, the page saves without error, but the return from the CGI seems to be of type text/plain, because I see the raw html code of the page.

In both cases, the save does happen, and the page is fine on reload.

Example

#format html
<body>
 ...

Details

MoinMoin Version

Release 1.2.3 [Revision 1.186]

OS and Version

SME Server 6.0 (based on RedHat 7.3)

Python Version

Python 2.2.2

Server Setup and Version

Apache 1.3.31

Server Details

using Authentication

This is the code for the html parser.

   1 """
   2     MoinMoin - HTML Text Parser
   3 
   4     Copyright (c) 2001 by Christian Bird <chris.bird@lineo.com>
   5     All rights reserved, see COPYING for details.
   6 
   7 """
   8 class Parser:
   9     """
  10         Send HTML code raw
  11     """
  12 
  13     def __init__(self, raw, request, **kw):
  14         self.html = raw
  15 
  16     def format(self, formatter):
  17         """ Send the "parsed" text.
  18         """
  19         #this is pretty easy since converting HTML to HTML is a no-brainer
  20         print self.html

Workaround

Discussion

The Parser is not valid. It uses print in its format routine, which is not allowed. Use request.write to output data to the request object. -- OliverGraf 2004-10-19 06:57:48

It took me hours and days to implement this... see ParserMarket for a 1.2 compatible version. -- OliverGraf 2004-10-19 07:19:18

I just looked and grabbed a copy of your parser under 1.2, but it didn't work either. I had to modify it. Here's my modified version. -- MichaelSoulier 2004-10-19 10:24:21

   1 class Parser:
   2     """
   3         Send HTML code raw
   4     """
   5 
   6     def __init__(self, raw, request):
   7         self.html = raw
   8         self.request = request
   9 
  10     def format(self, formatter):
  11         """ Send the "parsed" text.
  12         """
  13         # never use print, request write is the thing to use
  14         self.request.write(self.html)

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/HtmlParserSubmissionError (last edited 2007-10-29 19:13:00 by localhost)