[Zope] ZServer stepping on Content-Type and Content-Length?

Dieter Maurer dieter@handshake.de
Tue, 29 Aug 2000 21:37:14 +0200 (CEST)


Jeff Hoffman writes:
 > ....
 > In the index_html method, I have:
 > 
 >   RESPONSE.setHeader('Content-Type', 'video/foo')
 >   RESPONSE.setHeader('Content-Length', 1212)
 > ....
 > However, when I telnet to my web port and do:
 > 
 >   HEAD /path/to/myfile.mpg HTTP/1.0
 > 
 > I get:
 > 
 >   Content-Type: video/mpeg
 >   Content-Length: 0

The problem is, that a HEAD request does not execute
"index_html".
Instead, the "HEAD" method from "webdav.Resource" is
called.
It uses a "content_type" and "get_size" attribute/method
to set the "Content-Type" and "Content-Length" HTTP header.
If there is no "content_type" attribute/method, the
content type is guessed (via "mimetypes.guess_type").
If there is no "get_size", the "Content-Length" is 0.


Dieter