[BUG] [Zserver] GET and HEAD give different MIME types
application/octet-stream is sent when I HEAD while the proper text/html is sent if I GET??? And I don't have the same headers at all? ludwigV:/tmp % telnet www.sources.org 9673 Trying 172.19.1.1... Connected to ludwigv.sources.org. Escape character is '^]'. HEAD / HTTP/1.0 HTTP/1.0 200 OK Server: Zope/Zope 2.1.6 (source release, python 1.5.2, linux2) ZServer/1.1b1 Date: Tue, 28 Nov 2000 09:28:50 GMT Ms-Author-Via: DAV Content-Type: application/octet-stream Connection: close Date: Tue, 28 Nov 2000 09:28:50 GMT Connection: close Content-Length: 1024 Last-Modified: Mon, 3 May 1999 22:50:29 GMT Connection closed by foreign host. ludwigV:/tmp % telnet www.sources.org 9673 Trying 172.19.1.1... Connected to ludwigv.sources.org. Escape character is '^]'. GET / HTTP/1.0 HTTP/1.0 200 OK Server: Zope/Zope 2.1.6 (source release, python 1.5.2, linux2) ZServer/1.1b1 Date: Tue, 28 Nov 2000 09:29:09 GMT Connection: close Content-Type: text/html Content-Length: 1297 <HTML><HEAD>
On Tue, Nov 28, 2000 at 10:31:18AM +0100, Stephane Bortzmeyer wrote:
application/octet-stream is sent when I HEAD while the proper text/html is sent if I GET??? And I don't have the same headers at all?
<<SNIP>>
Server: Zope/Zope 2.1.6 (source release, python 1.5.2, linux2) ZServer/1.1b1
This behaviour has changed, updated if you like, since version 2.2.0b1. See the change file: http://www.zope.org/Products/Zope/2.2.0b1/CHANGES.txt Note that you don't want the DTML code to be called on a HEAD request; it may have side effects a mere tpc_abort won't roll back. -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ ---------------------------------------------
On Tuesday 28 November 2000, at 21 h 18, the keyboard of Martijn Pieters <mj@digicool.com> wrote:
Note that you don't want the DTML code to be called on a HEAD request; it may have side effects a mere tpc_abort won't roll back.
I understand but this seems a deviation (I don't say a violation since the RFC says SHOULD and not MUST) from the RFC on HTTP (2616): 9.4 HEAD The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. It is certainly a big problem for debugging or for robots which assume they can test with HEAD.
On Wed, Nov 29, 2000 at 12:06:23PM +0100, Stephane Bortzmeyer wrote:
On Tuesday 28 November 2000, at 21 h 18, the keyboard of Martijn Pieters <mj@digicool.com> wrote:
Note that you don't want the DTML code to be called on a HEAD request; it may have side effects a mere tpc_abort won't roll back.
I understand but this seems a deviation (I don't say a violation since the RFC says SHOULD and not MUST) from the RFC on HTTP (2616):
9.4 HEAD
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request.
It is certainly a big problem for debugging or for robots which assume they can test with HEAD.
The SHOULD in that text is there _because_ not all web environments can reliably generate a HEAD response without invoking undesired side-effects. It is easy with a static website, where there won't be any side effects to only sending the headers going with a URL, but with a dynamic web server this is quite different. If this is really a big problem for you I suggest you upgrade to Zope 2.2.0 or higher. Quite some trouble is taken to ensure that a more meaningful content-type is returned: - If the published object has a 'content_type' attribute, it's value will be used first. - If absent, the ID of the object will be used to guess it's content type. Only object names which use extensions benefit (for example: logo.gif is probably 'image/gif'). - If no guess could be made, the property 'default_content_type' is used. DTML Documents and Methods define this as 'text/html'. - Only when all three steps above fail will the content type 'application/octet-stream' be used. I believe that only the 3rd step was added in 2.2.0b1, so you could try and add a 'content_type' property to DTML objects that *must* return a correct content-type. -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ ---------------------------------------------
participants (2)
-
Martijn Pieters -
Stephane Bortzmeyer