[Zope-dev] Re: [Zope] IE5 / Medusa bug?

Evan Simpson evan@4-am.com
Fri, 15 Dec 2000 11:42:12 -0500


From: seb bacon <seb@jamkit.com>
> As Martijn correctly pointed out, there seems to be a Content-length
> problem going on here.  I did a lot more tests on two different 2.2
> servers, and have come closer to isolating the bug.

It's a ZPublisher/HTTPResponse.py bug.  When you render a Folder, it inserts
the <base href=...> and adjusts the content-length.  When the RESPONSE is
rendered, it notices that the </head> is missing and tries to fix your HTML
(adding precisely 14 bytes), but doesn't bother to re-adjust the
content-length.

I've fixed this in CVS by removing the code that attempts to fix HTML, since
that is *wrong* behavior.  You can do the same by removing the following
lines:

            else:
                isHTML = split(headers.get('content-type', ''),
                               ';')[0] == 'text/html'
            if isHTML and end_of_header_search(self.body) < 0:
                lhtml=html_search(body)
                if lhtml >= 0:
                    lhtml=lhtml+6
                    body='%s<head></head>\n%s' % (body[:lhtml],body[lhtml:])
                elif contHTML:
                    body='<html><head></head>\n' + body
                else:
                    body='<html><head></head>\n' + body + '\n</html>\n'
                self.setBody(body)
                body=self.body

Cheers,

Evan @ digicool & 4-am