Roxen.git
/
server
/
base_server
/
module.pike
version
»
Context lines:
10
20
40
80
file
none
3
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.
211
2004/05/
14
21
:
42
:
47
mast
Exp $
+
// $Id: module.pike,v 1.
212
2004/05/
15
11
:
23
:
36
grubba
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:596:
result = properties->remove_property(prop_name); if (result && result->error >= 300) { properties->unroll(); return result; } properties->commit(); return 0; }
-
string resource_id (string path, RequestID id)
+
string resource_id (string path, RequestID
|int(0..0)
id)
//! Return a string that within the filesystem uniquely identifies the //! resource on @[path] in the given request. This is commonly @[path] //! itself but can be extended with e.g. language, user or some form //! variable if the path is mapped to different files according to //! those fields. //! //! The important criteria here is that every unique returned string //! corresponds to a resource that can be changed independently of //! every other. Thus e.g. dynamic pages that evaluate to different //! results depending on variables or cookies etc should _not_ be
Roxen.git/server/base_server/module.pike:623:
//! each other. There's also a notion of recursive locks there, which //! means that a recursive lock on a certain resource identifier also //! locks every resource whose identifier it is a prefix of. Therefore //! it's typically necessary to ensure that every identifier ends with //! "/" so that a recursive lock on e.g. "doc/foo" doesn't lock //! "doc/foobar". //! //! @param path //! The requested path below the filesystem location. It has been //! normalized with @[VFS.normalize_path].
+
//!
+
//! @param id
+
//! The request id may have the value @expr{0@} (zero) if called
+
//! by @[Configuration()->expire_locks()].
{ return has_suffix (path, "/") ? path : path + "/"; } string|int authenticated_user_id (string path, RequestID id) //! Return a value that uniquely identifies the user that the given //! request is authenticated as. //! //! This function is e.g. used by the default lock implementation to //! tell different users holding locks apart. WARNING: Due to some
Roxen.git/server/base_server/module.pike:944:
//! This function is only provided as a helper to call from //! @[unlock_file] if the default lock implementation is to be used. //! //! @param path //! Normalized path (below the filesystem location) that the lock //! applies to. //! //! @param lock //! The lock to unregister. (It must not be changed or destructed.) //!
-
//!
@returns
-
//!
Returns
a
status
mapping
on
any
error,
zero
otherwise
.
-
static void unregister_lock (string path, DAVLock lock, RequestID id)
+
//!
@param id
+
//!
The
request
id
may
have
the
value
@expr{0@} (
zero
)
if called
+
//! by @[Configuration()->expire_locks()]
.
+
static void unregister_lock (string path, DAVLock lock, RequestID
|int(0..0)
id)
{ TRACE_ENTER(sprintf("unregister_lock(%O, lock(%O), X).", path, lock->locktoken), this);
-
mixed auth_user = authenticated_user_id (path, id);
+
mixed auth_user =
id &&
authenticated_user_id (path, id);
path = resource_id (path, id); DAVLock removed_lock; if (lock->recursive) {
-
+
if (id) {
removed_lock = m_delete(prefix_locks[path], auth_user);
-
+
} else {
+
foreach(prefix_locks[path]; mixed user; DAVLock l) {
+
if (l == lock) {
+
removed_lock = m_delete(prefix_locks[path], user);
+
}
+
}
+
}
if (!sizeof (prefix_locks[path])) m_delete (prefix_locks, path); } else if (file_locks[path]) {
-
+
if (id) {
removed_lock = m_delete (file_locks[path], auth_user);
-
+
} else {
+
foreach(file_locks[path]; mixed user; DAVLock l) {
+
if (l == lock) {
+
removed_lock = m_delete(file_locks[path], user);
+
}
+
}
+
}
if (!sizeof (file_locks[path])) m_delete (file_locks, path); } ASSERT_IF_DEBUG (lock /*%O*/ == removed_lock /*%O*/, lock, removed_lock); TRACE_LEAVE("Ok."); return 0; } //! Register @[lock] on the path @[path] under the assumption that //! there is no other lock already that conflicts with this one, i.e. //! that @code{check_locks(path,lock->recursive,id)@} would return