Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS.   //      // @appears Configuration   //! A site's main configuration    - constant cvs_version = "$Id: configuration.pike,v 1.566 2004/05/04 13:01:31 grubba Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.567 2004/05/04 13:23:46 grubba Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>   #include <timers.h>      #define CATCH(P,X) do{mixed e;if(e=catch{X;})report_error("While "+P+"\n"+describe_backtrace(e));}while(0)      // --- Locale defines ---   //<locale-token project="roxen_start"> LOC_S </locale-token>
Roxen.git/server/base_server/configuration.pike:1352:    }    multiset(DAVLock) sub_locks =    function_object(func)->find_locks(subpath, recursive,    exclude_shared, id);    if (sub_locks) locks |= sub_locks;    }    return locks;   }      //! Check if there are any applicable locks for this user on @[path]. - int(-2..1)|DAVLock check_locks(string path, int(0..1) recursive, RequestID id) + int(0..3)|DAVLock check_locks(string path, int(0..1) recursive, RequestID id)   { -  +  int state = 0;    foreach(location_module_cache||location_modules(),    [string loc, function func])    {    string subpath;    if (has_prefix(path, loc)) {    // path == loc + subpath.    subpath = path[sizeof(loc)..];    } else if (recursive && has_prefix(loc, path)) {    // loc == path + ignored.    subpath = "/";    } else {    // Does not apply to this location module.    continue;    } -  int(-2..1)|DAVLock lock_info = +  int(0..3)|DAVLock lock_info =    function_object(func)->check_locks(subpath, recursive, id); -  if (lock_info) return lock_info; +  if (objectp(lock_info)) { +  if (has_prefix(path, loc)) { +  return lock_info; +  } else { +  lock_info = 2; // We have a lock on some subpath.    } -  return 0; +     } -  +  if (lock_info > state) state = lock_info; +  if (state == 3) return 3; +  } +  return state; + }      //! Unlock the lock represented by @[lock] on @[path].   //!   //! @returns   //! Returns a result-mapping on error, and @expr{0@} (zero) on success.   mapping(string:mixed) unlock_file(string path, DAVLock lock, RequestID id)   {    // Canonicalize path.    if (!has_suffix(path, "/")) path+="/";   
Roxen.git/server/base_server/configuration.pike:1434:    string lockscope,    string locktype,    string owner,    RequestID id)   {    // Canonicalize path.    if (!has_suffix(path, "/")) path+="/";       // First check if there's already some lock on path that prevents    // us from locking it. -  int(-2..1)|DAVLock lock_info = check_locks(path, recursive, id); +  int(0..3)|DAVLock lock_info = check_locks(path, recursive, id);       if (!intp(lock_info)) {    // We already hold a lock that prevents us.    return Roxen.http_status(412, "Precondition Failed"); -  } else if ((lock_info < 0) || -  (lock_info && (lockscope == "DAV:exclusive"))) { +  } else if ((lock_info & 1) || +  ((lock_info == 2) && (lockscope == "DAV:exclusive"))) {    // Some other lock prevents us.    return Roxen.http_status(423, "Locked");    }       // Create the new lock.       string locktoken = "opaquelocktoken:" + roxen->new_uuid_string();    DAVLock lock = DAVLock(locktoken, path, recursive, lockscope, locktype,    owner);    foreach(location_module_cache||location_modules(),