[ZCM] [ZC] 1866/ 8 Comment "304 responses should not have Content-Length header"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Tue Mar 27 10:32:08 EDT 2007


Issue #1866 Update (Comment) "304 responses should not have Content-Length header"
 Status Pending, ZServer/bug+solution medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1866

==============================================================
= Comment - Entry #8 by betabug on Mar 27, 2007 10:31 am

Also: Current versions of Safari have a problem with content-type 'text/plain' being present on 304 replies.
________________________________________
= Comment - Entry #7 by jens on Aug 24, 2005 3:44 am

Just to have all the relevant info in in one place, here are links to the discussion on zope-dev:

http://mail.zope.org/pipermail/zope-dev/2005-August/025297.html

http://mail.zope.org/pipermail/zope-dev/2005-August/025303.html

http://mail.zope.org/pipermail/zope-dev/2005-August/025309.html

________________________________________
= Comment - Entry #6 by jens on Aug 15, 2005 3:11 am

Thanks for taking the time to flesh that out. That patch looks great.

________________________________________
= Comment - Entry #5 by dunny on Aug 15, 2005 2:20 am


Uploaded:  "zserver-content-length.patch"
 - http://www.zope.org/Collectors/Zope/1866/zserver-content-length.patch/view
The thing I was more concerned about was a side effect of the original patch where a 304 would now force a connection close.

Uploading a patch that has a go at trying to avoid that. (Using Zope-2_8-branch.)
________________________________________
= Comment - Entry #4 by jens on Aug 14, 2005 6:02 pm

Well, if you have the time to check every single response status and see if it needs a content-length header set, or if you want to make 100% sure none of the other "unwanted" headers are set for a 304 response, feel free to submit an improved patch. I don't have that time so I was concentrating on the specific problem at hand, the content-length header for 304 responses.

________________________________________
= Comment - Entry #3 by dunny on Aug 14, 2005 4:43 pm

Some thoughts about the patch:

Probably want to check the handling of the Connection header. Don't need to use "Connection: close" for a 304 for example?

Might as well handle the other status that also don't want a content length: 100, 101, 102, 204?

Should the approach be more forceful and explicitly remove any Content-Length header? (At the moment the patch avoids adding Content-Length but that does not stop application code from getting it wrong.)
________________________________________
= Comment - Entry #2 by jens on Aug 14, 2005 11:41 am


Uploaded:  "zserver_response.patch"
 - http://www.zope.org/Collectors/Zope/1866/zserver_response.patch/view
Attaching patch
________________________________________
= Request - Entry #1 by jens on Aug 14, 2005 11:40 am

According to RFC 2616, 304 responses should not have a Content-Length header (and a few others Zope is sending, but this is strictly about content-length). While it is possible to prevent setting a content-length header in application code (such as in OFS.Image etc), ZServer.HTTPResponse is overly helpful and forces one if it does not exist.

The included patch and test (against the Zope 2.7 branch as of August 14th, 2005) fixes this and should apply cleanly against the Zope 2.8 branch and HEAD. Cannot test that right now because I am on dialup and svn.zope.org just hangs when I am trying to get it.

This report is an extension of a CMF collector report:

http://www.zope.org/Collectors/CMF/372

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



More information about the Zope-Collector-Monitor mailing list