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.213 2004/05/17 17:44:58 mast Exp $ + // $Id: module.pike,v 1.214 2004/05/17 18:22:21 mast 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:1131:    TRACE_LEAVE("Locked, no if header.");    return Roxen.http_status(Protocols.HTTP.DAV_LOCKED);    }    SIMPLE_TRACE_LEAVE("No lock and no if header - ok%s.",    got_sublocks ? " (this level only)" : "");    return got_sublocks; // No condition and no lock -- Ok.    }       string|int(-1..0) etag;    -  mapping(string:mixed) res = -  lock && Roxen.http_status(Protocols.HTTP.DAV_LOCKED); +  int(0..1) locked_fail = !!lock;    next_condition:    foreach(condition, array(array(string)) sub_cond) {    SIMPLE_TRACE_ENTER(this,    "Trying condition ( %{%s:%O %})...", sub_cond);    int negate;    DAVLock locked = lock;    foreach(sub_cond, array(string) token) {    switch(token[0]) {    case "not":    negate = !negate;
Roxen.git/server/base_server/module.pike:1168:    }    } else if (negate) {    // Etag match with negated expression.    TRACE_LEAVE("Matched negated etag.");    continue next_condition;    }    negate = 0;    break;    case "key":    // The user has specified a key, so don't fail with DAV_LOCKED. -  if (res && res->error == Protocols.HTTP.DAV_LOCKED) { -  res = 0; -  } +  locked_fail = 0;    if (negate) {    if (lock && lock->locktoken == token[1]) {    TRACE_LEAVE("Matched negated lock.");    continue next_condition; // Fail.    }    } else if (!lock || lock->locktoken != token[1]) {    // Lock mismatch.    TRACE_LEAVE("Lock mismatch.");    continue next_condition; // Fail.    } else {
Roxen.git/server/base_server/module.pike:1195:    }    }    if (!locked) {    TRACE_LEAVE("Found match.");    SIMPLE_TRACE_LEAVE("Ok%s.",    got_sublocks ? " (this level only)" : "");    return got_sublocks; // Found matching sub-condition.    }    SIMPLE_TRACE_LEAVE("Conditional ok, but still locked (locktoken: %O).",    lock->locktoken); +  locked_fail = 1;    }       TRACE_LEAVE("Failed."); -  return res || Roxen.http_status(Protocols.HTTP.HTTP_PRECOND_FAILED); +  return Roxen.http_status(locked_fail ? +  Protocols.HTTP.DAV_LOCKED : +  Protocols.HTTP.HTTP_PRECOND_FAILED);   }      //! Used by some default implementations to check if we may perform a   //! write access to @[path]. It should at least call   //! @[check_if_header] to check DAV locks. It takes the same arguments   //! and has the same return value as that function.   //!   //! WARNING: This function has some design issues and will very likely   //! get a different interface. Compatibility is NOT guaranteed.   //!