[Zope] Workaround: Zope 2.1.6: "Invalid Header" Error

Dieter Maurer dieter@handshake.de
Mon, 14 Aug 2000 23:52:27 +0200 (CEST)


Me and lots of collegues have been plagued by occasional
"Invalid Header" Zope errors.

The analysis revealed:

  Zope tries to be CGI compliant:

    A CGI reponse can be preceeded by a sequence of
    HTTP headers separated by a blank line from the
    response body.

  Zope 2.1.6 (and before) uses a regular expression
  to determine whether or not such a header is present
  and a different regular expression to analyse each
  successive header.
  The first regular expression is buggy: leading
  whitespace can convince it that there is a header
  although it is not.
  The second regular expression then fails to parse
  this "header" and the "Invalid Header" exception
  is raised.


The code has been greatly improved in Zope 2.2.

For Zope 2.1.x, there is an easy workaround for the
problem. Start the DTML with an empty line.
This lets the first regular expression recognize
an empty HTTP header, the second regular expression
is not called.


Dieter