Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:1290:    DAVLock lock,    RequestID|int(0..0) id);      //! Checks that the conditions specified by the WebDAV @expr{"If"@}   //! header are fulfilled on the given path (RFC 2518 9.4). This means   //! that locks are checked as necessary using @[check_locks].   //!   //! WARNING: This function has some design issues and will very likely   //! get a different interface. Compatibility is NOT guaranteed.   //! - //! @param path - //! Path (below the filesystem location) that the lock applies to. + //! @param relative_path + //! Path (below the filesystem location) to check the if header for.   //!   //! @param recursive   //! If @expr{1@} also check write access recursively under @[path].   //!   //! @returns   //! Returns @expr{0@} (zero) on success, a status mapping on   //! failure, or @expr{1@} if @[recursive] is set and write access is   //! allowed on this level but maybe not somewhere below. The caller   //! should in the last case do the operation on this level if   //! possible and then handle each member in the directory
Roxen.git/server/base_server/module.pike:1548:    foreach(find_dir(path, id) || ({}), string fname) {    fname = path + fname;    if (Stat sub_stat = stat_file (fname, id)) {    SIMPLE_TRACE_ENTER (this, "Deleting %O", fname);    if (mapping(string:mixed) sub_res = recurse(fname, sub_stat)) {    // RFC 2518 8.6.2    // Additionally 204 (No Content) errors SHOULD NOT be returned    // in the 207 (Multi-Status). The reason for this prohibition    // is that 204 (No Content) is the default success code.    if (sizeof (sub_res) && sub_res->error != 204) { -  stat->add_status(fname, sub_res->error, sub_res->rettext); +  stat->add_status(fname, sub_res);    }    if (!sizeof (sub_res) || sub_res->error >= 300) fail = 1;    }    }    }    if (fail) {    SIMPLE_TRACE_LEAVE ("Partial failure");    return ([]);    }    }
Roxen.git/server/base_server/module.pike:1721:    //    // 412 (Precondition Failed) - /.../ the Overwrite header    // is "F" and the state of the destination resource is    // non-null.    //    // That clearly doesn't include this case. Also, common sense    // says that the error from the failed delete is more useful    // to the client.   #if 0    return Roxen.http_status(Protocols.HTTP.HTTP_PRECOND_FAILED); - #else + #elif 0    if (sizeof (res)) {    // RFC 2518 8.8.3:    // If an error in executing the COPY method occurs with a    // resource other than the resource identified in the    // Request-URI then the response MUST be a 207    // (Multi-Status).    //    // So if the failure was on the root destination resource we    // have to convert it to a multi-status.    result->add_status (destination, res->error, res->rettext);    }    return ([]); -  + #else +  // RFC 4918 9.8.5: +  // 423 (Locked) - The destination resource, or resource +  // within the destination collection, was locked. This +  // response SHOULD contain the 'lock-token-submitted' +  // precondition element. +  return res;   #endif    }    TRACE_LEAVE("Deletion ok.");    break;    case NEVER_OVERWRITE:    TRACE_LEAVE("Destination already exists.");    return Roxen.http_status(Protocols.HTTP.HTTP_PRECOND_FAILED);    case MAYBE_OVERWRITE:    // No overwrite header.    // Be nice, and fail only if we don't already have a collection.    if (st->isdir) {    TRACE_LEAVE("Destination exists and is a directory.");    return copy_properties(source, destination, behavior, id);    }    TRACE_LEAVE("Destination exists and is not a directory."); -  return Roxen.http_status(Protocols.HTTP.HTTP_PRECOND_FAILED); +  return Roxen.http_status(Protocols.HTTP.HTTP_CONFLICT);    }    }    // Create the new collection.    TRACE_LEAVE("Make a new collection.");    mapping(string:mixed) res = make_collection(destination, id);    if (res && res->error >= 300) return res; -  return copy_properties(source, destination, behavior, id) || res; +  res = copy_properties(source, destination, behavior, id) || res; +  if (res && st && (res->error == Protocols.HTTP.HTTP_CREATED)) { +  // RFC 4918 9.8.5: +  // 204 (No Content) - The source resource was successfully +  // copied to a preexisting destination resource. +  res->error = Protocols.HTTP.HTTP_NO_CONTENT;    } -  +  return res; + }      //! Used by the default @[recurse_copy_files] to copy a single file   //! along with its properties.   //!   //! @param source   //! Source path below the filesystem location.   //!   //! @param destination   //! Destination path below the filesystem location.   //!