Branch: Tag:

2004-06-02

2004-06-02 21:49:34 by Martin Stjernholm <mast@lysator.liu.se>

Fixed error handling when properties are queried so that e.g. a 401 response
from query_property_set doesn't get wrapped in a MultiStatus. Note that this
fix disables unified directory listings over several file systems.

Rev: server/base_server/module.pike:1.215
Rev: server/base_server/prototypes.pike:1.139
Rev: server/modules/misc/webdav.pike:1.37

1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS. - // $Id: module.pike,v 1.214 2004/05/17 18:22:21 mast Exp $ + // $Id: module.pike,v 1.215 2004/06/02 21:49:32 mast Exp $      #include <module_constants.h>   #include <module.h>
425:      //! RFC 2518 PROPFIND implementation with recursion according to   //! @[depth]. See @[find_properties] for details. - void recurse_find_properties(string path, string mode, + mapping(string:mixed) recurse_find_properties(string path, string mode,    int depth, RequestID id,    multiset(string)|void filt)   {    MultiStatus.Prefixed result =    id->get_multi_status()->prefix (id->url_base() + query_location()[1..]);    -  void recurse (string path, int depth) { +  mapping(string:mixed) recurse (string path, int depth) {    SIMPLE_TRACE_ENTER (this, "%s for %O, depth %d",    mode == "DAV:propname" ? "Listing property names" :    mode == "DAV:allprop" ? "Retrieving all properties" :
443:       if (!properties) {    SIMPLE_TRACE_LEAVE ("No such file or dir"); -  return; +  return 0;    }       {
451:    properties : properties->find_properties(mode, result, filt);       if (ret) { -  result->add_status (path, ret->error, ret->rettext); +     SIMPLE_TRACE_LEAVE ("Got status %d: %O", ret->error, ret->rettext); -  return; +  return ret;    }    }       if (properties->get_stat()->isdir) {    if (depth <= 0) {    SIMPLE_TRACE_LEAVE ("Not recursing due to depth limit"); -  return; +  return 0;    }    depth--;    foreach(find_dir(path, id) || ({}), string filename) { -  recurse(combine_path_unix(path, filename), depth); +  filename = combine_path_unix(path, filename); +  if (mapping(string:mixed) sub_res = recurse(filename, depth)) +  if (sizeof (sub_res)) +  result->add_status (filename, sub_res->error, sub_res->rettext);    }    }       SIMPLE_TRACE_LEAVE (""); -  +  return ([]);    };    -  recurse (path, depth); +  return recurse (path, depth);   }      mapping(string:mixed) patch_properties(string path,