[Zope-dev] DAV collections, index_html, and HEAD

Andreas Jung andreas@andreas-jung.com
Thu, 6 Jun 2002 20:04:13 -0400


Can you file a collector issue please?

-aj
----- Original Message -----
From: "Karl Anderson" <kra@monkey.org>
To: <zope-dev@zope.org>
Sent: Thursday, June 06, 2002 19:44
Subject: [Zope-dev] DAV collections, index_html, and HEAD


>
> Objects that inherit from Folder (and therefore from Collection) and
> also have an index_html that's a Python method (or othewise
> nonvanilla, presumably) return a 405 (Method Not Allowed) for HTTP
> HEAD requests.
>
> Zope 2.5.1 raises on line 57 of Collection.py.  The object raises if
> its index_html member doesn't have a HEAD attribute.
>
> Surely it's a bug to only give HEAD for objects that return an
> index_html via hasattr/getattr.  What about getitem,
> __bobo_traverse__, and __call__?  Shouldn't we find the object to HEAD
> via ZPublisher?  And aren't we bypassing the access control checks,
> anyway?
>
> Would it be a good idea to try and make up a HEAD response for
> arbitrary attributes that don't support it (such as Python methods)?
> Perhaps by publishing them internally, and picking whatever we can
> from RESPONSE, computing Content-Length from the returned stream if
> necessary?  It's inefficient, but at least it's cache-friendly... and
> better for tools (er, linbot) that assume that if it can't be found
> via HEAD, it isn't there.
>
> Excerpt from Collection.HEAD():
>
>         # Note that we are willing to acquire the default document
>         # here because what we really care about is whether doing
>         # a GET on this collection / would yield a 200 response.
>         if hasattr(self, 'index_html'):
>             if hasattr(self.index_html, 'HEAD'):
>                 return self.index_html.HEAD(REQUEST, RESPONSE)
>             raise 'Method Not Allowed', (
>                   'Method not supported for this resource.'
>                   )
>         raise 'Not Found', 'The requested resource does not exist.'
>
>
>
>
>
> persephone ~/tmp= telnet viii.dclxvi.org 80
> Trying 206.163.69.253...
> Connected to viii.dclxvi.org.
> Escape character is '^]'.
> HEAD /blog HTTP/1.0
> HEAD /blog HTTP/1.0
>
>
> HTTP/1.1 405 Method Not Allowed
> Date: Thu, 06 Jun 2002 02:22:40 GMT
> Server: Apache/1.3.12 (Unix) mod_ssl/2.6.6 OpenSSL/0.9.5a
> Bobo-Exception-File: /usr/local/zope/2-5-1/lib/python/webdav/Collection.py
> Bobo-Exception-Line: 57
> Bobo-Exception-Type: Method Not Allowed
> Bobo-Exception-Value: bobo exception
> Connection: close
> Content-Location: http://viii.dclxvi.org/blog/
> Ms-Author-Via: DAV
> X-Powered-By: Zope (www.zope.org), Python (www.python.org)
> Content-Length: 2106
> Content-Type: text/html
>
>
> --
> Karl Anderson      kra@monkey.org           http://www.monkey.org/~kra/
>
>
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>