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.151 2004/03/01 19:10:19 grubba Exp $ + // $Id: module.pike,v 1.152 2004/03/01 19:26:42 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:773:    }   }      // 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]. - void patch_property_start(string path, RequestID id) + //! + //! @returns + //! Returns a context that will be passed to @[set_property()], + //! @[remove_property()], @[patch_property_commit()] + //! and @[patch_property_unroll()]. + mixed patch_property_start(string path, RequestID 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) + 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) + void patch_property_commit(string path, RequestID id, mixed context)   {   }      void patch_properties(string path, array(PatchPropertyCommand) instructions,    MultiStatus result, RequestID id)   { -  patch_property_start(path, id); +  mixed context = patch_property_start(path, id);       array(mapping(string:mixed)) results;       mixed err = catch { -  results = instructions->execute(path, this_object(), id); +  results = instructions->execute(path, this_object(), id, context);    };    if (err) {    foreach(instructions, PatchPropertyCommand instr) {    result->add_property(path, instr->property_name, answer);    } -  patch_property_unroll(path, id); +  patch_property_unroll(path, id, context);    throw (err);    } else {    int any_failed;    foreach(results, mapping(string:mixed) answer) {    if (any_failed = (answer && (answer->error >= 300))) {    break;    }    }    if (any_failed) {    // Unroll and fail any succeeded items.
Roxen.git/server/base_server/module.pike:826:    Roxen.http_low_answer(424, "Failed dependency.");    for(i = 0; i < sizeof(results); i++) {    if (!results[i] || results[i]->error < 300) {    result->add_property(path, instructions[i]->property_name,    answer);    } else {    result->add_property(path, instructions[i]->property_name,    results[i]);    }    } -  patch_property_unroll(path, id); +  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); +  patch_property_commit(path, id, context);    }    }   }      mapping copy_file(string path, string dest, int(-1..1) behavior, RequestID id)   {    werror("copy_file(%O, %O, %O, %O)\n",    path, dest, behavior, id);    return Roxen.http_low_answer(501, "Not implemented.");   }