[ZCM] [ZC] 1151/ 2 Comment "HTTP Compression broken on error pages"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Wed Dec 22 10:32:13 EST 2004
Issue #1151 Update (Comment) "HTTP Compression broken on error pages"
Status Pending, Zope/bug+solution medium
To followup, visit:
http://zope.org/Collectors/Zope/1151
==============================================================
= Comment - Entry #2 by maport on Dec 22, 2004 10:32 am
This can also occur when the server is returning a non-error response and again this is not rendered by the browser because it is sent uncompressed but with a gzip header.
I haven't tracked down exactly what situation causes this but can replicate it using a script to send continuous GET requests to my site. I'm guessing it may be when a ConflictError occurs.
The compression-fix.diff patch fixes this for me when applied to Zope 2.7.3.
Is this likely to make it into a future Zope release?
________________________________________
= Request - Entry #1 by eikenberry on Dec 12, 2003 7:09 pm
Uploaded: "compression-fix.diff"
- http://zope.org/Collectors/Zope/1151/compression-fix.diff/view
If you've enabled HTTP compression via RESPONSE.enableHTTPCompression() and you get an error on your site (so it uses the standard_error_message) the 'content-encoding' headers is set to 'gzip' but the content is sent in plain text. This specifically causes problems with Mozilla 1.4 and Firebird 0.7, where you get a blank page. This is in the Mozilla tracker, but is reported as not being a bug, as it is technically a server error (though they do talk about issuing a warning or something).
The problem seems to come from the setBody() method on HTTPResponse.py. When checking to see if it should compress the content it runs this little test:
if self.use_HTTP_content_compression and \
not self.headers.get('content-encoding',None):
But in the case of an error, setBody() has already been run and thus the 'content-encoding' has already been set to 'gzip' (this happens in the above test's block). Thus this test fails when being run again for the body of the error message, so it doesn't compress the content.
Changing the above test to something like this [below] would fix this issue.
if self.use_HTTP_content_compression and \
self.headers.get('content-encoding','gzip') == 'gzip':
==============================================================
More information about the Zope-Collector-Monitor
mailing list