Curious about age old WebDAV decisions...
I've got a Folder (indirection) and a DTML Method (found) in the root of a Zope site. HEAD requests fail on the indirected DTML Method due to OFS.ObjectManager's __getitem__ method: def __getitem__(self, key): import pdb;pdb.set_trace() v=self._getOb(key, None) if v is not None: return v if hasattr(self, 'REQUEST'): request=self.REQUEST method=request.get('REQUEST_METHOD', 'GET') if request.maybe_webdav_client and not method in ('GET', 'POST'): return NullResource(self, key, request).__of__(self) raise KeyError, key I wasn't around during the development of the WebDAV code, so I'm loathe to just jump in and start changing things, but why isn't 'HEAD' exempted from the NullResource as well, given that HTTP specs state that HEAD *must* return the same headers that a GET would provide (ignoring for the moment the Collector issue thread over whether HEAD should provide the length of the source of a document or its fully rendered content - let's just try to make sure both methods work on the *same object*). What was the reasoning behind the decision? These changes happened way back in the Dark Ages (late March 1999 or so, earlier in the month, this code was added to OFS.Folder with the initial WebDAV support). A trip through the WayBackMachine™ shows no discussion in the Zope-dev lists in early 1999 when this was being worked on, and no real mention of WebDAV in Zope for most of the rest of that year (on Zope-dev or the general Zope list). Am I mistaking this for a problem? ~ zbir@gorilla $ curl http://localhost:2277/found hello~ zbir@gorilla $ curl http://localhost:2277/indirection/found hello~ zbir@gorilla $ curl -I http://localhost:2277/found HTTP/1.1 200 OK Server: Apache Date: Wed, 28 Dec 2005 18:59:58 GMT Last-Modified: Wed, 28 Dec 2005 18:54:07 GMT Accept-Ranges: none Content-Type: text/html Content-Length: 5 ~ zbir@gorilla $ curl -I http://localhost:2277/indirection/found HTTP/1.1 404 Not Found Server: Apache Date: Wed, 28 Dec 2005 19:00:10 GMT Bobo-Exception-Line: 63 Content-Length: 891 Bobo-Exception-Value: See the server error log for details Content-Type: text/html Accept-Ranges: none Bobo-Exception-File: NullResource.py Bobo-Exception-Type: NotFound Thanks, Zac
I wasn't around during the development of the WebDAV code, so I'm loathe to just jump in and start changing things, but why isn't 'HEAD' exempted from the NullResource as well, given that HTTP specs state that HEAD *must* return the same headers that a GET would provide (ignoring for the moment the Collector issue thread over whether HEAD should provide the length of the source of a document or its fully rendered content - let's just try to make sure both methods work on the *same object*). What was the reasoning behind the decision? These changes happened way back in the Dark Ages (late March 1999 or so, earlier in the month, this code was added to OFS.Folder with the initial WebDAV support). A trip through the WayBackMachine™ shows no discussion in the Zope-dev lists in early 1999 when this was being worked on, and no real mention of WebDAV in Zope for most of the rest of that year (on Zope-dev or the general Zope list). Am I mistaking this for a problem?
The HEAD method is a bit of problem generally -- by the book it should return the exact same thing as a GET sans the content body. In a dynamic system like Zope about the only way I can think of to have the right thing happen would be to have goo in the publisher that turns a HEAD into a GET to let normal GET control flow happen, then have the response bits know that this has happened and discard the content body. <...sound of retching...> In any case, treating HEAD like the other lesser-used HTTP methods like DELETE, etc. is probably not the right thing to do, but what exactly the right thing should be is unclear. Another fun tidbit is that DAV clients often use HEAD to test for the existence of resources and other things, so if HEAD is treated *exactly* like a GET in Z2 you'll get problems due to acquisition (you might get a HEAD response for an acquired object that isn't really there, which will make DAV clients go insane). That convoluted code in the publisher pre-dates the idea of a dedicated DAV server -- probably the right thing to do today would be to have the DAV server config the publisher to never acquire, then you dont have unresolvable ambiguities. Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com
Zachery Bir wrote at 2005-12-28 14:27 -0500:
I've got a Folder (indirection) and a DTML Method (found) in the root of a Zope site. HEAD requests fail on the indirected DTML Method due to OFS.ObjectManager's __getitem__ method:
def __getitem__(self, key): import pdb;pdb.set_trace() v=self._getOb(key, None) if v is not None: return v if hasattr(self, 'REQUEST'): request=self.REQUEST method=request.get('REQUEST_METHOD', 'GET') if request.maybe_webdav_client and not method in ('GET', 'POST'): return NullResource(self, key, request).__of__(self) raise KeyError, key
I wasn't around during the development of the WebDAV code, so I'm loathe to just jump in and start changing things, but why isn't 'HEAD' exempted from the NullResource as well, given that HTTP specs state that HEAD *must* return the same headers that a GET would provide
Looks like a bug (not only here but probably at other places as well). Altogether, this treatment is buggy: it cannot be the responsibility of "ObjectManager.__getitem__" to handle things only senseful during traversal; "ObjectManager[...]" can be called long after traversal finished and then returning a "NullResource" definitely is stupid. -- Dieter
participants (3)
-
Brian Lloyd -
Dieter Maurer -
Zachery Bir