Skip to content

Commit

Permalink
Pass all litmus basic tests without warnings
Browse files Browse the repository at this point in the history
-> running `basic':
 0. init.................. pass
 1. begin................. pass
 2. options............... pass
 3. put_get............... pass
 4. put_get_utf8_segment.. pass
 5. put_no_parent......... pass
 6. mkcol_over_plain...... pass
 7. delete................ pass
 8. delete_null........... pass
 9. delete_fragment....... pass
10. mkcol................. pass
11. mkcol_again........... pass
12. delete_coll........... pass
13. mkcol_no_parent....... pass
14. mkcol_with_body....... pass
15. finish................ pass
  • Loading branch information
gedaiu committed Feb 22, 2015
1 parent 6bbc2f9 commit 0d2ec9a
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions source/vibedav/base.d
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,6 @@ final class DavFileResource : DavResource {
override void copy(URL destinationURL, bool overwrite = false) {
string destinationPath = (fileRoot ~ destinationURL.path.toString[1..$]).toString.decode;

writeln("COPY: ", destinationPath);

if(!overwrite && destinationPath.exists)
throw new DavException(HTTPStatus.preconditionFailed, "Destination already exists.");

Expand Down Expand Up @@ -616,13 +614,8 @@ abstract class Dav {
void put(HTTPServerRequest req, HTTPServerResponse res) {
string path = getRequestPath(req);

writeln("PUT ", path);
writeln("PUT ", req.headers);

DavResource resource = getOrCreateResource(req.fullURL, res.statusCode);

writeln("resource ", resource);

auto content = req.bodyReader.readAll;
resource.setContent(content);

Expand Down Expand Up @@ -652,8 +645,11 @@ abstract class Dav {
string path = getRequestPath(req);

res.statusCode = HTTPStatus.noContent;
auto selectedResource = getResource(req.fullURL);
selectedResource.remove();

if(req.fullURL.anchor != "" || req.requestURL.indexOf("#") != -1)
throw new DavException(HTTPStatus.conflict, "Missing parent");

getResource(req.fullURL).remove();

res.writeBody("", "text/plain");
}
Expand Down Expand Up @@ -719,9 +715,6 @@ HTTPServerRequestDelegate serveDav(T : Dav)(Path path) {
void callback(HTTPServerRequest req, HTTPServerResponse res)
{
try {

writeln("==> GOT: ", req.method, " ", req.path);

if(req.method == HTTPMethod.OPTIONS) {
dav.options(req, res);
} else if(req.method == HTTPMethod.PROPFIND) {
Expand Down

0 comments on commit 0d2ec9a

Please sign in to comment.