Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:878:    foreach (prefix_locks; PATH; LOCKS) {CODE;} \    } while (0)      //! Find some or all locks that apply to @[path].   //!   //! @param path   //! Normalized path below the filesystem location.   //!   //! @param recursive   //! If @expr{1@} also return locks anywhere below @[path]. + //! If @expr{-1} return locks anywhere below @[path], but not + //! any above @[path]. (This is appropriate to use to get the + //! list of locks that need to be unlocked on DELETE.)   //!   //! @param exclude_shared   //! If @expr{1@} do not return shared locks that are held by users   //! other than the one the request is authenticated as. (This is   //! appropriate to get the list of locks that would conflict if the   //! current user were to make a shared lock.)   //!   //! @returns   //! Returns a multiset containing all applicable locks in   //! this location module, or @expr{0@} (zero) if there are none.   //!   //! @note   //! @[DAVLock] objects may be created if the filesystem has some   //! persistent storage of them. The default implementation does not   //! store locks persistently.   //!   //! @note   //! The default implementation only handles the @expr{"DAV:write"@}   //! lock type.   multiset(DAVLock) find_locks(string path, -  int(0..1) recursive, +  int(-1..1) recursive,    int(0..1) exclude_shared,    RequestID id)   {    // Common case.    if (!sizeof(file_locks) && !sizeof(prefix_locks)) return 0;       TRACE_ENTER(sprintf("find_locks(%O, %O, %O, X)",    path, recursive, exclude_shared), this);       string rsc = resource_id (path, id);
Roxen.git/server/base_server/module.pike:931:    }    else    add_locks = lambda (mapping(mixed:DAVLock) sub_locks) {    locks |= mkmultiset (values (sub_locks));    };       if (file_locks[rsc]) {    add_locks (file_locks[rsc]);    }    +  if (recursive >= 0) {    foreach(prefix_locks;    string prefix; mapping(mixed:DAVLock) sub_locks) {    if (has_prefix(rsc, prefix)) {    add_locks (sub_locks);    break;    }    } -  +  }       if (recursive) {    LOOP_OVER_BOTH (string prefix, mapping(mixed:DAVLock) sub_locks, {    if (has_prefix(prefix, rsc)) {    add_locks (sub_locks);    }    });    }       add_locks = 0;
Roxen.git/server/base_server/module.pike:1399:    TRACE_LEAVE("Found match.");    SIMPLE_TRACE_LEAVE("Ok%s.",    got_sublocks ? " (this level only)" : "");    return got_sublocks; // Found matching sub-condition.    }    SIMPLE_TRACE_LEAVE("Conditional ok, but still locked (locktoken: %O).",    lock->locktoken);    locked_fail = 1;    }    -  TRACE_LEAVE("Failed."); +  if (locked_fail) { +  TRACE_LEAVE("Failed (locked)."); +  } else { +  TRACE_LEAVE("Precondition failed."); +  }    return Roxen.http_status(locked_fail ?    Protocols.HTTP.DAV_LOCKED :    Protocols.HTTP.HTTP_PRECOND_FAILED);   }      //! Used by some default implementations to check if we may perform a   //! write access to @[path]. It should at least call   //! @[check_if_header] to check DAV locks. It takes the same arguments   //! and has the same return value as that function.   //!