Closed jojomay24 closed 1 year ago
It is expected to throw a HttpResponseException
.
I researched a little more, what really happens is: Since the directory is locked, the apache responds with Http 207 Multi-Status. This MultiStatus response contains 2 elements: One is a Http 424 failed dependency, another is a Http 423 Locked. However, since the main response is a 2xx Status, I suppose this is the reason why there is no HttpResponseException. According to webdav rfc 4918,chapter 13, "the recipient needs to consult the contents of the multistatus response body for further information about the success or failure of the method execution". See an XML excerpt as an example for such an multistatus response:
Hypertext Transfer Protocol
HTTP/1.1 207 Multi-Status\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 207 Multi-Status\r\n]
[Message: HTTP/1.1 207 Multi-Status\r\n]
[Severity level: Chat]
[Group: Sequence]
Request Version: HTTP/1.1
Status Code: 207
Response Phrase: Multi-Status
Date: Fri, 15 May 2015 13:14:52 GMT\r\n
Server: Apache/2.4.7 (Ubuntu)\r\n
Content-Length: 736\r\n
[Content length: 736]
Connection: close\r\n
Content-Type: text/xml; charset="utf-8"\r\n
\r\n
[HTTP response 4/4]
[Prev request in frame: 29]
[Prev response in frame: 30]
eXtensible Markup Language
<?xml
version="1.0"
encoding="utf-8"
?>
<D:multistatus
xmlns:D="DAV:">
<D:response>
<D:href>
/webdav/testFiles/file0.txt
</D:href>
<D:status>
HTTP/1.1 424 Failed Dependency
</D:status>
<D:responsedescription>
An error occurred on another resource, preventing the requested operation on this resource.
</D:responsedescription>
</D:response>
<D:response>
<D:href>
/webdav/testFiles
</D:href>
<D:status>
HTTP/1.1 423 Locked
</D:status>
<D:responsedescription>
A validation error has occurred on the parent resource, preventing the operation on the resource specified by the Request-URI. The error was: This resource is locked and an
"If:" header was not supplied to allow access to the resource.
</D:responsedescription>
</D:response>
</D:multistatus>
best regards, alex
I'm having a similar issue where DELETEs are returning a 207 status code, but no exception is thrown. The problem seems to be in this class:
where it's just considering any 2xx response as a success.
Consider following pseudo - code snippet:
Since the webdav directory "someRemoteDir" is locked, the subsequent sardine.put does not copy data into that directory, which is correct behaviour. However, sardine does not throw any Exception neither does it return success/failure since it is a void method. As consequence, the programmer has no chance to somehow realize that the sardine.put(...) did not yield the expected result. and the file was not copied. May be an exception would be a good idea?