[Zope-dev] Bug in Zope 2.x.x

Adam Karpierz karpierz@itl.pl
Wed, 5 Jan 2000 18:59:09 +0100


> Hmm.. this sounds like it might be the same bug I reported before the
> new year, (http://lists.zope.org/pip
ermail/zope/1999-December/015874.html)
> but I didn't see it on Linux, just FreeBSD... what OS are you using?

I think than not the same.
It happens for every files  and not depend on kind of OS.
The reason of this bug is increase of self.body
(adding <base href=..></base>) but without increasing
'content-length' HTTP header in method
HTTPResponse.insertBase from file
Zope/lib/python/ZPublisher/HTTPResponse.py

=================================

    def insertBase(self,
                   base_re_search=rege
.compile('\(<base[\0- ]+[^>]+>\)',
                                                regex.casefold).search
                   ):
        if (self.headers.has_key('content-type') and
            self.headers['content-type'] != 'text/html'): return

        if self.base:
            body=self.body
            if body:
                e=end_of_header_search(body)
                if e >= 0:
                    b=base_re_search(body)
                    if b < 0:
                        self.body=('%s\t<base href="%s">\n%s' %
                                   (body[:e],self.base,body[e:]))
                        self.setHeader('content-length',len(self.body))
# above line is missing in original HTTPResposne.py


Adam Karpierz
karpierz@itl.pl