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.570 2004/05/07 17:32:23 grubba Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.571 2004/05/07 19:45:49 mast 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:1366:    locks |= sub_locks;    } else {    TRACE_LEAVE("Got no locks.");    }    }    SIMPLE_TRACE_LEAVE("Returning %O", locks);    return locks;   }      //! Check if there are any applicable locks for this user on @[path]. - int(0..3)|DAVLock check_locks(string path, int(0..1) recursive, RequestID id) + DAVLock|LockFlag check_locks(string path, int(0..1) recursive, RequestID id)   { -  int state = 0; +  LockFlag state = 0;    foreach(location_module_cache||location_modules(),    [string loc, function func])    {    string subpath; -  +  int check_above;    if (has_prefix(path, loc)) {    // path == loc + subpath.    subpath = path[sizeof(loc)..];    } else if (recursive && has_prefix(loc, path)) {    // loc == path + ignored. -  subpath = "/"; +  subpath = ""; +  check_above = 1;    } else {    // Does not apply to this location module.    continue;    } -  int(0..3)|DAVLock lock_info = +  int/*LockFlag*/|DAVLock lock_info =    function_object(func)->check_locks(subpath, recursive, id);    if (objectp(lock_info)) { -  if (has_prefix(path, loc)) { +  if (!check_above) {    return lock_info;    } else { -  lock_info = 2; // We have a lock on some subpath. +  lock_info = LOCK_OWN_BELOW; // We have a lock on some subpath.    }    } -  +  else +  if (check_above && (lock_info & 1)) +  // Convert LOCK_*_AT to LOCK_*_BELOW. +  lock_info &= ~1;    if (lock_info > state) state = lock_info; -  if (state == 3) return 3; +  if (state == LOCK_EXCL_AT) return LOCK_EXCL_AT; // Doesn't get any worse.    }    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)   {
Roxen.git/server/base_server/configuration.pike:1457:    string lockscope,    string locktype,    array(Parser.XML.Tree.Node) 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(0..3)|DAVLock lock_info = check_locks(path, recursive, id); +  int/*LockFlag*/|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 & 1) || -  ((lock_info == 2) && (lockscope == "DAV:exclusive"))) { +  } else if (lockscope == "DAV:exclusive" ? +  lock_info >= LOCK_SHARED_BELOW : +  lock_info >= LOCK_OWN_BELOW) {    // 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(),