Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:1664:    //    // 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.   //!