[Zope] Management of HEAD requests

2011-03-15 Thread Jesus Cea
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

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.

A (mostly) happy user since 1998.

- -- 
Jesus Cea Avion _/_/  _/_/_/_/_/_/
j...@jcea.es - http://www.jcea.es/ _/_/_/_/  _/_/_/_/  _/_/
jabber / xmpp:j...@jabber.org _/_/_/_/  _/_/_/_/_/
.  _/_/  _/_/_/_/  _/_/  _/_/
Things are not so easy  _/_/  _/_/_/_/  _/_/_/_/  _/_/
My name is Dump, Core Dump   _/_/_/_/_/_/  _/_/  _/_/
El amor es poner tu felicidad en la felicidad de otro - Leibniz
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQCVAwUBTX9d95lgi5GaxT1NAQJl6AP/cd4gkk2ekPaue2Ikd1K2FQ6tKv1fEve7
x/TEzFH4q5b9PfTeABt0zQuUkudoWOk0C4qljlX2+Z7zF/xvsBWbQGamrgu8c588
jKIL27/NhsqJdeY2K7lNIlrZGk5wl49dSOlR+tJDoSqJjl7yDXLtZ2iuT0SZYK7v
CeDUEeWO6mw=
=O7xc
-END PGP SIGNATURE-
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Management of HEAD requests

2011-03-15 Thread Tres Seaver
-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  tsea...@palladion.com
Palladion Software   Excellence by Designhttp://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-

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )