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.
153
2004/03/
01
20
:
21
:
05
mast
Exp $
+
// $Id: module.pike,v 1.
154
2004/03/
03
16
:
25
:
24
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:740:
//! @param filt //! Optional multiset of requested properties. If this parameter //! is @expr{0@} (zero) then all available properties are requested. //! @param st //! If set, this should be the stat that corresponds to @[path]. Its //! only purpose is to save a call to @[stat_file] when the stat //! already has been retrieved. //! //! @note //! id->not_query() does not necessarily contain the same value as @[path].
-
void
find_properties(string path, string mode, MultiStatus result,
-
RequestID
id,
multiset(string)|void filt, void|Stat st)
+
mapping(string:mixed)
find_properties(string path, string mode,
+
MultiStatus result,
RequestID id,
+
multiset(string)|void filt, void|Stat st)
{ if (!st) { st = stat_file(path, id);
-
if (!st) return;
+
if (!st) return
0
;
} switch(mode) { case "DAV:propname": foreach(indices(query_all_properties(path, id, st)), string prop_name) { result->add_property(path, prop_name, ""); }
-
return;
+
return
0
;
case "DAV:allprop": if (filt) { // Used in http://sapportals.com/xmlns/cm/webdavinclude case. // (draft-reschke-webdav-allprop-include-04). filt |= query_all_properties(path, id, st); } else { filt = query_all_properties(path, id, st); } // FALL_THROUGH case "DAV:prop": foreach(indices(filt), string prop_name) { result->add_property(path, prop_name, query_property(path, prop_name, id, st)); }
-
return;
+
return
0
;
} // FIXME: Unsupported DAV operation.
-
return;
+
return
0
;
}
-
void recurse_find_properties(string path, string mode,
int
depth,
-
MultiStatus result,
-
RequestID id, multiset(string)|void filt, void|Stat st)
+
void recurse_find_properties(string path, string mode,
+
int
depth,
MultiStatus result,
+
RequestID id,
+
multiset(string)|void filt,
+
void|Stat st)
{ if (!st) { st = stat_file(path, id);
-
if (!st) return;
+
if (!st)
{
+
return;
}
-
+
}
-
+
mapping(string:mixed) ret =
find_properties(path, mode, result, id, filt, st);
-
+
if (ret) {
+
result->add_response(path, XMLStatusNode(ret->error));
+
return;
+
}
if ((depth <= 0) || !st->isdir) return; depth--;
-
foreach(find_dir(path, id), string filename) {
+
foreach(find_dir(path, id)
|| ({})
, string filename) {
recurse_find_properties(combine_path(path, filename), mode, depth, result, id, filt); }
-
+
return;
} // RFC 2518 8.2 // Instructions MUST either all be executed or none executed. // Thus if any error occurs during procesing all executed // instructions MUST be undone and a proper error result // returned. //! Signal start of patching of properties for @[path]. //! //! @returns
-
//!
Returns
a
context
that
will be passed to @[set_property()],
-
//! @[remove_property()], @[patch_property_commit()]
-
//! and @[patch_property_unroll()].
+
//!
@mixed
+
//!
@type zero
+
//! File not found. @[patch_property_unroll()]
will
+
//!
not
be
called in this case.
+
//! @type mapping
+
//! Return code. No patching will be performed.
+
//! @type mixed
+
//! A context to be
passed to @[set_property()],
+
//!
@[remove_property()], @[patch_property_commit()]
+
//!
and @[patch_property_unroll()].
+
//! @endmixed
mixed patch_property_start(string path, RequestID id) {
-
+
return !!stat_file(path, id);
} //! Patching of the properties for @[path] failed. //! Restore the state to what it was when @[patch_property_start()] //! was called. void patch_property_unroll(string path, RequestID id, mixed context) { } //! Patching of the properties for @[path] succeeded. void patch_property_commit(string path, RequestID id, mixed context) { }
-
void
patch_properties(string path, array(PatchPropertyCommand) instructions,
+
mapping(string:mixed)
patch_properties(string path,
+
array(PatchPropertyCommand) instructions,
MultiStatus result, RequestID id) { mixed context = patch_property_start(path, id);
-
+
if (!context || mappingp(context)) {
+
return context;
+
}
+
array(mapping(string:mixed)) results; mixed err = catch { results = instructions->execute(path, this_object(), id, context); }; if (err) { patch_property_unroll(path, id, context); throw (err); } else { int any_failed;
Roxen.git/server/base_server/module.pike:864:
patch_property_unroll(path, id, context); } else { int i; for(i = 0; i < sizeof(results); i++) { result->add_property(path, instructions[i]->property_name, results[i]); } patch_property_commit(path, id, context); } }
+
return 0;
} //! Convenience variant of @[set_property] that sets a single //! property: The default implementation calls //! @[patch_property_start], @[set_property], @[patch_property_unroll] //! and @[patch_property_commit] as appropriate. mapping(string:mixed) set_single_property (string path, string prop_name, string|array(Parser.XML.Tree.Node) value, RequestID id) {