Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS. - // $Id: module.pike,v 1.210 2004/05/14 21:18:04 mast Exp $ + // $Id: module.pike,v 1.211 2004/05/14 21:42:47 mast Exp $      #include <module_constants.h>   #include <module.h>   #include <request_trace.h>      constant __pragma_save_parent__ = 1;      inherit "basic_defvar";   mapping(string:array(int)) error_log=([]);   
Roxen.git/server/base_server/module.pike:701:    int(0..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);    -  path = resource_id (path, id); +  string rsc = resource_id (path, id);       multiset(DAVLock) locks = (<>);    function(mapping(mixed:DAVLock):void) add_locks;       if (exclude_shared) {    mixed auth_user = authenticated_user_id (path, id);    add_locks = lambda (mapping(mixed:DAVLock) sub_locks) {    foreach (sub_locks; string user; DAVLock lock)    if (user == auth_user ||    lock->lockscope == "DAV:exclusive")    locks[lock] = 1;    };    }    else    add_locks = lambda (mapping(mixed:DAVLock) sub_locks) {    locks |= mkmultiset (values (sub_locks));    };    -  if (file_locks[path]) { -  add_locks (file_locks[path]); +  if (file_locks[rsc]) { +  add_locks (file_locks[rsc]);    }       foreach(prefix_locks;    string prefix; mapping(mixed:DAVLock) sub_locks) { -  if (has_prefix(path, prefix)) { +  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, path)) { +  if (has_prefix(prefix, rsc)) {    add_locks (sub_locks);    }    });    }       add_locks = 0;       TRACE_LEAVE(sprintf("Done, found %d locks.", sizeof(locks)));       return sizeof(locks) && locks;
Roxen.git/server/base_server/module.pike:813:    RequestID id)   {    TRACE_ENTER(sprintf("check_locks(%O, %d, X)", path, recursive), this);       // Common case.    if (!sizeof(file_locks) && !sizeof(prefix_locks)) {    TRACE_LEAVE ("Got no locks");    return 0;    }    +  mixed auth_user = authenticated_user_id (path, id);    path = resource_id (path, id);    -  mixed auth_user = authenticated_user_id (path, id); -  +     if (DAVLock lock =    file_locks[path] && file_locks[path][auth_user] ||    prefix_locks[path] && prefix_locks[path][auth_user]) {    TRACE_LEAVE(sprintf("Found lock %O.", lock->locktoken));    return lock;    }       LockFlag shared;       if (mapping(mixed:DAVLock) locks = file_locks[path]) {
Roxen.git/server/base_server/module.pike:913:   //!   //! @note   //! The default implementation only handles the @expr{"DAV:write"@}   //! lock type. It uses @[resource_id] to map paths to unique resources   //! and @[authenticated_user_id] to tell users apart.   static void register_lock(string path, DAVLock lock, RequestID id)   {    TRACE_ENTER(sprintf("register_lock(%O, lock(%O), X).", path, lock->locktoken),    this);    ASSERT_IF_DEBUG (lock->locktype == "DAV:write"); -  path = resource_id (path, id); +     mixed auth_user = authenticated_user_id (path, id); -  +  path = resource_id (path, id);    if (lock->recursive) {    if (prefix_locks[path]) {    prefix_locks[path][auth_user] = lock;    } else {    prefix_locks[path] = ([ auth_user:lock ]);    }    } else {    if (file_locks[path]) {    file_locks[path][auth_user] = lock;    } else {