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.191 2004/05/10 17:19:13 grubba Exp $ + // $Id: module.pike,v 1.192 2004/05/10 18:38:17 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:1052:    if (!if_data || !sizeof(condition = if_data[path] || if_data[0])) {    if (lock) {    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.    }    -  mapping(string:mixed) res; +  mapping(string:mixed) res = +  lock && Roxen.http_status(Protocols.HTTP.DAV_LOCKED);    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;    break;    case "etag":    // Not supported yet. We ignore this if some other condition    // matches.    res = Roxen.http_status (Protocols.HTTP.HTTP_NOT_IMPL,    "Etag conditions not supported.");    TRACE_LEAVE("Conditional etag not supported.");    continue next_condition; // Fail.    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; +  }    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:1297:    return Roxen.http_status (Protocols.HTTP.HTTP_NOT_IMPL);   }      mapping recurse_copy_files(string source, string destination, int depth,    mapping(string:PropertyBehavior) behavior,    Overwrite overwrite,    MultiStatus.Prefixed result, RequestID id)   {    SIMPLE_TRACE_ENTER(this, "recurse_copy_files(%O, %O, %O, %O, %O, %O)\n",    source, destination, depth, behavior, result, id); -  if ((source == destination) || -  has_prefix(source, destination) || -  has_prefix(destination, source)) { +  string src_tmp = has_suffix(source, "/")?source:(source+"/"); +  string dst_tmp = has_suffix(destination, "/")?destination:(destination+"/"); +  if ((src_tmp == dst_tmp) || +  has_prefix(src_tmp, dst_tmp) || +  has_prefix(dst_tmp, src_tmp)) {    TRACE_LEAVE("Source and destination overlap.");    return Roxen.http_status(403, "Source and destination overlap.");    }    Stat st = stat_file(source, id);    if (!st) {    TRACE_LEAVE("Source not found.");    return 0; /* FIXME: 404? */    }    // FIXME: Check destination?    if (st->isdir) {