[Zope] Management of HEAD requests
Tres Seaver
tseaver at palladion.com
Tue Mar 15 11:23:11 EDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/15/2011 08:39 AM, Jesus Cea wrote:
> Using Zope 2.10 here.
>
> When making a HEAD request, I get the "last-modified" time of the
> script, and an "application/octet-stream" content type. The content
> length is the script length.
>
> When doing a GET request, I get a "last-modified" time of "now" and a
> "text/html" content type. And the length is correct here.
>
> As far as I know, the HEAD doesn't reach the script, it is processed
> inside Zope. I would rather prefer to actually process the script but
> give back only the headers.
>
> That is, my problem is that HEAD and GET of the same object provide
> completely different information about different objects (HEAD gives
> info about the actual script, GET gives info of the script output). This
> could be even a privacy issue, giving out script details people don't
> need to know.
>
> Is there any way to override this?. Suggestion?
>
> I have issues, for instance, managing RSS feeds, since some clients do a
> HEAD request instead of a conditional GET, for detecting new entries.
>
> Thanks in advance, folks.
The default HED implementation is in 'webdav.Resource': it makes some
assumptions which are not appropriate. You can override it for your own
content objects: here is what App.ImageFile does::
security.declarePublic('HEAD')
def HEAD(self, REQUEST, RESPONSE):
""" """
RESPONSE.setHeader('Content-Type', self.content_type)
RESPONSE.setHeader('Last-Modified', self.lmh)
return ''
IMNSHO, there is absolutely no general way for a dynamic application to
satisfy clients that use HEAD instead of conditional get: the semantics
they rely on are meaningless for dynamically generated content.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk1/hF8ACgkQ+gerLs4ltQ6BFACghX5SqjeN+NjEx5diEy5uokI1
zqAAnihau7b4qPt8ECNIErAtkz2sKWuN
=epmV
-----END PGP SIGNATURE-----
More information about the Zope
mailing list