Example #1
0
    def doCopy(r):
        destination, destination_uri, depth = r

        # May need to add a location header
        addLocation(request, destination_uri)

        return copy(self.fp, destination.fp, destination_uri, depth)
Example #2
0
    def doMove(r):
        destination, destination_uri, depth = r

        #
        # RFC 2518, section 8.9 says that we must act as if the Depth header is set
        # to infinity, and that the client must omit the Depth header or set it to
        # infinity.
        #
        # This seems somewhat at odds with the notion that a bad request should be
        # rejected outright; if the client sends a bad depth header, the client is
        # broken, and section 8 suggests that a bad request should be rejected...
        #
        # Let's play it safe for now and ignore broken clients.
        #
        if self.fp.isdir() and depth != "infinity":
            msg = "Client sent illegal depth header value for MOVE: %s" % (depth,)
            log.err(msg)
            raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))

        # May need to add a location header
        addLocation(request, destination_uri)

        return move(self.fp, request.uri, destination.fp, destination_uri, depth)