Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

update to jsdav to nodejs 0.6 #27

Merged
merged 13 commits into from

2 participants

This page is out of date. Refresh to see the latest.
Showing with 143 additions and 276 deletions.
  1. +6 −15 .gitmodules
  2. +11 −0 README.md
  3. +1 −1  lib/DAV/fs/directory.js
  4. +1 −1  lib/DAV/ftp/directory.js
  5. +29 −32 lib/DAV/handler.js
  6. +1 −1  lib/DAV/objectTree.js
  7. +8 −4 lib/DAV/plugins/codesearch.js
  8. +7 −6 lib/DAV/plugins/filelist.js
  9. +1 −1  lib/DAV/plugins/filesearch.js
  10. +1 −1  lib/DAV/plugins/locks.js
  11. +1 −1  lib/DAV/plugins/locks/fs.js
  12. +1 −1  lib/DAV/plugins/temporaryfilefilter.js
  13. +1 −2  lib/DAV/server.js
  14. +1 −1  lib/DAV/sftp/directory.js
  15. +1 −1  lib/DAV/tree/filesystem.js
  16. +1 −1  lib/DAV/tree/ftp.js
  17. +1 −1  lib/DAV/tree/sftp.js
  18. +3 −7 lib/DAV/util.js
  19. +0 −59 lib/find/async-map.js
  20. +0 −81 lib/find/find.js
  21. +0 −35 lib/find/graceful-fs.js
  22. 0  {support → node_modules}/jsftp
  23. 0  {support → node_modules}/node-sftp
  24. +8 −1 package.json
  25. +0 −1  support/async.js
  26. +0 −1  support/formidable
  27. +0 −1  support/node-o3-xml-v4
  28. +42 −0 test/test_filelist.js
  29. +1 −1  test/test_ftp.js
  30. +2 −3 test/test_mount.js
  31. +7 −8 test/test_statfs.js
  32. +7 −8 test/test_xml.js
View
21 .gitmodules
@@ -1,15 +1,6 @@
-[submodule "support/async.js"]
- path = support/async.js
- url = https://github.com/fjakobs/async.js.git
-[submodule "support/formidable"]
- path = support/formidable
- url = https://github.com/felixge/node-formidable.git
-[submodule "support/node-o3-xml-v4"]
- path = support/node-o3-xml-v4
- url = https://github.com/ajaxorg/node-o3-xml-v4.git
-[submodule "support/node-sftp"]
- path = support/node-sftp
- url = https://github.com/ajaxorg/node-sftp.git
-[submodule "support/jsftp"]
- path = support/jsftp
- url = https://github.com/ajaxorg/jsftp.git
+[submodule "node_modules/node-sftp"]
+ path = node_modules/node-sftp
+ url = http://github.com/ajaxorg/node-sftp.git
+[submodule "node_modules/jsftp"]
+ path = node_modules/jsftp
+ url = http://github.com/ajaxorg/jsftp.git
View
11 README.md
@@ -4,6 +4,15 @@ jsDAV
jsDAV allows you to easily add WebDAV support to a NodeJS application.
jsDAV is meant to cover the entire standard, and attempts to allow integration using an easy to understand API.
+SabreDAV
+--------
+jsDAV started as a port of [SabreDAV] to NodeJS Javascript, written by Evert Pot
+and maintained by Evert and contributors.
+[SabreDAV] is regarded as one of the highest quality WebDAV implementations around
+and is written entirely in PHP and is the most feature complete implementation
+that I've seen to date. I am watching the [SabreDAV] repository closely for changes,
+improvements and bugfixes, to see if they can be ported to jsDAV.
+
Features
--------
@@ -18,6 +27,7 @@ Features in development
* Pass all Litmus tests
* CalDAV (to be tested with Evolution, iCal, iPhone and Lightning).
+ * CardDAV (to be tested with OSX addressbook, the iOS addressbook and Evolution)
Supported RFC's
---------------
@@ -36,6 +46,7 @@ RFC's in development
* [RFC4918]: WebDAV revision
* CalDAV ctag, CalDAV-proxy
+[SabreDAV]: http://code.google.com/p/sabredav/
[RFC2617]: http://www.ietf.org/rfc/rfc2617.txt
[RFC2518]: http://www.ietf.org/rfc/rfc2518.txt
[RFC3744]: http://www.ietf.org/rfc/rfc3744.txt
View
2  lib/DAV/fs/directory.js
@@ -14,7 +14,7 @@ var jsDAV_iCollection = require("./../iCollection").jsDAV_iCollection;
var jsDAV_iQuota = require("./../iQuota").jsDAV_iQuota;
var Fs = require("fs");
-var Async = require("./../../../support/async.js");
+var Async = require("asyncjs");
var Exc = require("./../exceptions");
function jsDAV_FS_Directory(path) {
View
2  lib/DAV/ftp/directory.js
@@ -14,7 +14,7 @@ var jsDAV_iCollection = require("./../iCollection").jsDAV_iCollection;
var jsDAV_iQuota = require("./../iQuota").jsDAV_iQuota;
var Path = require("path");
-var Async = require("./../../../support/async.js");
+var Async = require("asyncjs");
var Exc = require("./../exceptions");
function jsDAV_Ftp_Directory(path, ftp) {
View
61 lib/DAV/handler.js
@@ -12,8 +12,8 @@ var Fs = require("fs");
var Path = require("path");
var Exc = require("./exceptions");
var Util = require("./util");
-var Async = require("./../../support/async.js");
-var Formidable = require("./../../support/formidable");
+var Async = require("asyncjs");
+var Formidable = require("formidable");
// DAV classes used directly by the Handler object
var jsDAV = require("./../jsdav");
@@ -667,7 +667,7 @@ exports.NS_AJAXORG = "http://ajax.org/2005/aml";
var self = this;
var uri = this.getRequestUri();
- this.getRequestBody("binary", function(err, body, cleanup) {
+ this.getRequestBody("binary", function(err, body) {
if (!Util.empty(err))
return self.handleError(err);
@@ -677,38 +677,29 @@ exports.NS_AJAXORG = "http://ajax.org/2005/aml";
if (err instanceof Exc.jsDAV_Exception_FileNotFound) {
// If we got here, the resource didn't exist yet.
self.createFile(uri, body, "binary", function() {
- cleanup();
self.httpResponse.writeHead(201, {"Content-Length": "0"});
self.httpResponse.end();
});
}
else {
- cleanup();
return self.handleError(err);
}
}
else {
// Checking If-None-Match and related headers.
self.checkPreconditions(false, function(err, redirected) {
- if (!Util.empty(err)) {
- cleanup();
+ if (!Util.empty(err))
return self.handleError(err);
- }
- if (redirected) {
- cleanup();
+ if (redirected)
return false;
- }
// If the node is a collection, we'll deny it
- if (!node.hasFeature(jsDAV.__IFILE__)) {
- cleanup();
+ if (!node.hasFeature(jsDAV.__IFILE__))
return self.handleError(new Exc.jsDAV_Exception_Conflict("PUT is not allowed on non-files."));
- }
self.dispatchEvent("beforeWriteContent", uri, function(stop) {
if (stop === true)
- return cleanup();
+ return;
node.put(body, "binary", function(err) {
- cleanup();
if (!Util.empty(err))
return self.handleError(err);
self.httpResponse.writeHead(200, {"Content-Length": "0"});
@@ -990,8 +981,8 @@ exports.NS_AJAXORG = "http://ajax.org/2005/aml";
var ctype;
var req = this.httpRequest;
var isStream = (!(ctype = req.headers["content-type"]) || !ctype.match(/(urlencoded|multipart)/i));
- var cleanup = function() {};
- var self = this;
+
+ var self = this;
// HACK: MacOSX Finder and NodeJS don't play nice together with files
// that start with '._'
@@ -1002,24 +993,27 @@ exports.NS_AJAXORG = "http://ajax.org/2005/aml";
if (enc == "raw")
enc = "binary";
if (req.$data) {
- return cbreqbody(null, enc == "binary"
+ return cbreqbody(req.$data.err || null, enc == "binary"
? req.$data
- : req.$data.toString(enc), cleanup);
+ : req.$data.toString(enc));
}
if (isStream) {
var stream = [];
+ var contentLength = req.headers["content-length"];
req.streambuffer.ondata(function(data) {
stream.push(data);
});
req.streambuffer.onend(function() {
- self.$reading = false;
- req.$data = Util.concatBuffers(stream);
- readDone(null, enc == "binary"
- ? req.$data
- : req.$data.toString(enc), cleanup);
+ var buff = Util.concatBuffers(stream);
+ if (contentLength && parseInt(contentLength, 10) != buff.length) {
+ readDone(new Exc.jsDAV_Exception_BadRequest("Content-Length mismatch: Request Header claimed "
+ + contentLength + " bytes, but received " + buff.length + " bytes"), buff);
+ }
+ else
+ readDone(null, buff);
});
}
else {
@@ -1028,11 +1022,8 @@ exports.NS_AJAXORG = "http://ajax.org/2005/aml";
form.addListener("file", function(field, file) {
Fs.readFile(file.path, function(err, data) {
- self.$reading = false;
- req.$data = data;
- readDone(err, enc == "binary" ? data : data.toString(enc), function() {
- Fs.unlink(file.path);
- });
+ readDone(err, data);
+ Fs.unlink(file.path);
});
});
@@ -1041,8 +1032,14 @@ exports.NS_AJAXORG = "http://ajax.org/2005/aml";
form.parse(req);
}
- function readDone(err, data, cleanup) {
- cbreqbody(err, data, cleanup);
+ function readDone(err, data) {
+ self.$reading = false;
+ req.$data = data;
+ if (err)
+ req.$data.err = err;
+ cbreqbody(err, enc == "binary"
+ ? req.$data
+ : req.$data.toString(enc));
}
};
View
2  lib/DAV/objectTree.js
@@ -10,7 +10,7 @@
var jsDAV = require("./../jsdav");
var jsDAV_Tree = require("./tree").jsDAV_Tree;
-var Async = require("./../../support/async.js");
+var Async = require("asyncjs");
var Util = require("./util");
var Exc = require("./exceptions");
View
12 lib/DAV/plugins/codesearch.js
@@ -131,7 +131,7 @@ jsDAV_Codesearch_Plugin.MAXSIZE = 2097152; //2MB
if (err)
return e.next(err);
if (jsDAV.debugMode)
- console.log("report" + reportName + ", " + node.path + ", " + require("sys").inspect(options));
+ console.log("report" + reportName + ", " + node.path + ", " + require("util").inspect(options));
self.doCodesearch(node, options, function(err, sResults) {
//if (err)
@@ -215,7 +215,7 @@ jsDAV_Codesearch_Plugin.MAXSIZE = 2097152; //2MB
}
this.parseSearchResult = function(res, basePath, options) {
- var namespace, prefix, lastFile, parts, file;
+ var namespace, prefix, lastFile, parts, file, lineno;
var aLines = (typeof res == "string" ? res : "").split(/([\n\r]+)/g);
var i = 0;
var count = 0;
@@ -233,7 +233,11 @@ jsDAV_Codesearch_Plugin.MAXSIZE = 2097152; //2MB
parts = aLines[i].split(":");
if (parts.length < 3) continue;
++count;
- if ((file = parts.shift()) !== lastFile) {
+ file = parts.shift();
+ lineno = parseInt(parts.shift(), 10);
+ if (!lineno)
+ continue;
+ if (file !== lastFile) {
if (lastFile)
aXml.push('</d:response>');
aXml.push('<d:response path="' + encodeURI(options.uri
@@ -241,7 +245,7 @@ jsDAV_Codesearch_Plugin.MAXSIZE = 2097152; //2MB
Util.escapeXml(options.query), '">');
lastFile = file;
}
- aXml.push('<d:excerpt line="', parts.shift(), '">',
+ aXml.push('<d:excerpt line="', lineno, '">',
Util.escapeXml(truncate(parts.join(":"), options)), '</d:excerpt>');
}
if (count > 0)
View
13 lib/DAV/plugins/filelist.js
@@ -11,7 +11,7 @@ var jsDAV = require("./../../jsdav");
var jsDAV_ServerPlugin = require("./../plugin").jsDAV_ServerPlugin;
var Util = require("./../util");
-var async = require("./../../../support/async.js");
+var async = require("asyncjs");
function jsDAV_Filelist_Plugin(handler) {
this.handler = handler;
@@ -28,7 +28,8 @@ jsDAV_Filelist_Plugin.FIND_CMD = "find";
this.httpReportHandler = function(e, reportName, dom) {
if (reportName != "{DAV:}filelist")
return e.next();
- //e.stop();
+
+ e.stop();
var uri = this.handler.getRequestUri();
var options = this.parseOptions(dom);
@@ -36,17 +37,17 @@ jsDAV_Filelist_Plugin.FIND_CMD = "find";
options.uri = uri;
this.handler.server.tree.getNodeForPath(uri, function(err, node) {
if (err)
- return e.next(err);
+ return self.handler.handleError(err);
if (jsDAV.debugMode)
- console.log("report" + reportName + ", " + node.path + ", " + require("sys").inspect(options));
+ console.log("report" + reportName + ", " + node.path + ", " + require("util").inspect(options));
self.doFilelist(node, options, function(err, sResults) {
if (!Util.empty(err))
- return e.next(err);
+ return self.handler.handleError(err);
+
self.handler.httpResponse.writeHead(207, {"Content-Type":"text/xml; charset=utf-8"});
self.handler.httpResponse.end(sResults);
- e.stop();
});
});
};
View
2  lib/DAV/plugins/filesearch.js
@@ -40,7 +40,7 @@ jsDAV_Filesearch_Plugin.FIND_CMD = "find";
return e.next(err);
if (jsDAV.debugMode)
- console.log("report" + reportName + ", " + node.path + ", " + require("sys").inspect(options));
+ console.log("report" + reportName + ", " + node.path + ", " + require("util").inspect(options));
self.doFilesearch(node, options, function(err, sResults) {
if (!Util.empty(err))
View
2  lib/DAV/plugins/locks.js
@@ -13,7 +13,7 @@ var jsDAV_Property_SupportedLock = require("./../property/supportedLock").jsDAV_
var jsDAV_Property_LockDiscovery = require("./../property/lockDiscovery").jsDAV_Property_LockDiscovery;
var jsDAV_Locks_LockInfo = require("./locks/lockinfo").jsDAV_Locks_LockInfo;
-var Async = require("./../../../support/async.js");
+var Async = require("asyncjs");
var Exc = require("./../exceptions");
var Util = require("./../util");
View
2  lib/DAV/plugins/locks/fs.js
@@ -12,7 +12,7 @@ var jsDAV_Server = require("./../../server");
var Fs = require("fs");
var Path = require("path");
-var Async = require("./../../../../support/async.js");
+var Async = require("asyncjs");
var Util = require("./../../util");
/**
View
2  lib/DAV/plugins/temporaryfilefilter.js
@@ -14,7 +14,7 @@ var jsDAV_Property_ResourceType = require("./../property/resourceType").jsDAV
var Fs = require("fs");
var Path = require("path");
-var Async = require("./../../../support/async.js");
+var Async = require("asyncjs");
var Exc = require("./../exceptions");
var Util = require("./../util");
View
3  lib/DAV/server.js
@@ -9,7 +9,6 @@
var Http = require("http");
var Url = require("url");
-var Sys = require("sys");
var Fs = require("fs");
var Exc = require("./exceptions");
@@ -231,7 +230,7 @@ exports.createServer = function(options, port, host) {
var server = new Server(options);
server.listen(port, host, function() {
- Sys.puts("jsDAV server running on http://" + host + ":" + port);
+ console.log("jsDAV server running on http://" + host + ":" + port);
});
return server;
};
View
2  lib/DAV/sftp/directory.js
@@ -13,7 +13,7 @@ var jsDAV_Directory = require("./../directory").jsDAV_Directory;
var jsDAV_iCollection = require("./../iCollection").jsDAV_iCollection;
var jsDAV_iQuota = require("./../iQuota").jsDAV_iQuota;
-var Async = require("./../../../support/async.js");
+var Async = require("asyncjs");
var Exc = require("./../exceptions");
function jsDAV_SFTP_Directory(path, sftp) {
View
2  lib/DAV/tree/filesystem.js
@@ -12,7 +12,7 @@ var jsDAV_FS_Directory = require("./../fs/directory").jsDAV_FS_Directory;
var jsDAV_FS_File = require("./../fs/file").jsDAV_FS_File;
var Fs = require("fs");
-var Async = require("./../../../support/async.js");
+var Async = require("asyncjs");
var Util = require("./../util");
var Exc = require("./../exceptions");
View
2  lib/DAV/tree/ftp.js
@@ -11,7 +11,7 @@ var jsDAV = require("../../jsdav");
var jsDAV_Tree = require("../tree").jsDAV_Tree;
var jsDAV_Ftp_Directory = require("../ftp/directory").jsDAV_Ftp_Directory;
var jsDAV_Ftp_File = require("../ftp/file").jsDAV_Ftp_File;
-var Ftp = require("../../../support/jsftp/jsftp");
+var Ftp = require("jsftp/jsftp");
var Exc = require("../exceptions");
var Path = require('path');
var Util = require("../util");
View
2  lib/DAV/tree/sftp.js
@@ -11,7 +11,7 @@ var jsDAV_Tree = require("./../tree").jsDAV_Tree;
var jsDAV_SFTP_Directory = require("./../sftp/directory").jsDAV_SFTP_Directory;
var jsDAV_SFTP_File = require("./../sftp/file").jsDAV_SFTP_File;
-var Sftp = require("./../../../support/node-ssh").sftp;
+var Sftp = require("node-ssh").sftp;
var Util = require("./../util");
var Exc = require("./../exceptions");
View
10 lib/DAV/util.js
@@ -9,13 +9,9 @@
var jsDAV = require("./../jsdav");
var Crypto = require("crypto");
-var Async = require("./../../support/async.js");
+var Async = require("asyncjs");
var Exc = require("./exceptions");
-
-if (process.version.split(".")[1] > 2)
- var Xml = require("./../../support/node-o3-xml-v4/lib/o3-xml");
-else
- var Xml = require("./../../support/node-o3-xml/lib/o3-xml");
+var Xml = require("libxml/lib/libxml");
if (jsDAV.debugMode) {
/*
@@ -945,7 +941,7 @@ exports.uniqid = function(prefix, more_entropy) {
exports.EventEmitter = function() {};
-exports.EventEmitter.DEFAULT_TIMEOUT = 2000; // in milliseconds
+exports.EventEmitter.DEFAULT_TIMEOUT = 10000; // in milliseconds
exports.EventEmitter.PRIO_LOW = 0x0001;
exports.EventEmitter.PRIO_NORMAL = 0x0002;
exports.EventEmitter.PRIO_HIGH = 0x0004;
View
59 lib/find/async-map.js
@@ -1,59 +0,0 @@
-/*
-usage:
-
-// do something to a list of things
-asyncMap(myListOfStuff, function (thing, cb) { doSomething(thing.foo, cb) }, cb)
-// do more than one thing to each item
-asyncMap(list, fooFn, barFn, cb)
-// call a function that needs to go in and call the cb 3 times
-asyncMap(list, callsMoreThanOnce, 3, cb)
-
-*/
-"use strict";
-
-module.exports = asyncMap
-
-function asyncMap () {
- var steps = Array.prototype.slice.call(arguments)
- , list = steps.shift() || []
- , cb_ = steps.pop()
- if (typeof cb_ !== "function") throw new Error(
- "No callback provided to asyncMap")
- if (!list) return cb_(null, [])
- if (!Array.isArray(list)) list = [list]
- var n = steps.length
- , data = [] // actually a 2d array
- , errState = null
- , l = list.length
- , a = l * n
- if (!a) return cb_(null, [])
- function cb (er) {
- if (errState) return
- var argLen = arguments.length
- for (var i = 1; i < argLen; i ++) if (arguments[i] !== undefined) {
- data[i - 1] = (data[i - 1] || []).concat(arguments[i])
- }
- // see if any new things have been added.
- if (list.length > l) {
- var newList = list.slice(l)
- a += (list.length - l) * n
- l = list.length
- process.nextTick(function () {
- newList.forEach(function (ar) {
- steps.forEach(function (fn) { fn(ar, cb) })
- })
- })
- }
- // allow the callback to return boolean "false" to indicate
- // that an error should not tank the process.
- if (er || --a === 0) {
- errState = er
- cb_.apply(null, [errState].concat(data))
- }
- }
- // expect the supplied cb function to be called
- // "n" times for each thing in the array.
- list.forEach(function (ar) {
- steps.forEach(function (fn) { fn(ar, cb) })
- })
-}
View
81 lib/find/find.js
@@ -1,81 +0,0 @@
-"use strict";
-
-// walks a set of directories recursively, and returns
-// the list of files that match the filter, if one is
-// provided.
-
-module.exports = find;
-
-var fs = require("./graceful-fs"),
- asyncMap = require("./async-map"),
- path = require("path");
-
-function find (dir, filter, depth, cb) {
- if (typeof cb !== "function") {
- cb = depth;
- depth = Infinity;
- }
- if (typeof cb !== "function") {
- cb = filter;
- filter = null;
- }
-
- if (filter instanceof RegExp) filter = reFilter(filter);
- if (typeof filter === "string") filter = strFilter(filter);
- if (!Array.isArray(dir)) dir = [dir];
- if (!filter) filter = nullFilter;
- asyncMap(dir, findDir(filter, depth), cb);
-}
-
-function findDir (filter, depth) {
- return function (dir, cb) {
- fs.lstat(dir, function (er, stats) {
- // don't include missing files, but don't abort either
- if (er) return cb();
- if (!stats.isDirectory()) return findFile(dir, filter, depth)("", cb);
- var found = [];
- //if (!filter || filter(dir, "dir")) found.push(dir+"/");
- if (dir[dir.length - 1] == '/')
- found.push(dir);
- else
- found.push(dir+"/");
- if (depth <= 0) return cb(null, found);
- cb = (function (cb) {
- return function (er, f) {
- cb(er, found.concat(f));
- };
- })(cb);
- fs.readdir(dir, function (er, files) {
- if (er) return cb(er);
- asyncMap(files, findFile(dir, filter, depth - 1), cb);
- });
- });
- };
-}
-
-function findFile (dir, filter, depth) {
- return function (f, cb) {
- f = path.join(dir, f);
- fs.lstat(f, function (er, s) {
- // don't include missing files, but don't abort either
- if (er) return cb();
- if (s.isDirectory()) return find(f, filter, depth, cb);
- if (!filter || filter(f, "file")) cb(null, f);
- else cb();
- });
- };
-}
-
-function reFilter (re) {
- return function (f, type) {
- return nullFilter(f, type) && f.match(re);
- };
-}
-
-function strFilter (s) {
- return function (f, type) {
- return nullFilter(f, type) && f.indexOf(s) === 0;
- };
-}
-
-function nullFilter (f, type) { return type === "file" && f; }
View
35 lib/find/graceful-fs.js
@@ -1,35 +0,0 @@
-"use strict";
-
-// wrapper around the non-sync fs functions to gracefully handle
-// having too many file descriptors open. Note that this is
-// *only* possible because async patterns let one interject timeouts
-// and other cleverness anywhere in the process without disrupting
-// anything else.
-var fs = require("fs")
- , timeout = 0
-
-Object.keys(fs)
- .forEach(function (i) {
- exports[i] = (typeof fs[i] !== "function") ? fs[i]
- : (i.match(/^[A-Z]|^create|Sync$/)) ? function () {
- return fs[i].apply(fs, arguments)
- }
- : graceful(fs[i])
- })
-
-function graceful (fn) { return function GRACEFUL () {
- var args = Array.prototype.slice.call(arguments)
- , cb_ = args.pop()
- args.push(cb)
- function cb (er) {
- if (er && er.message.match(/^EMFILE, Too many open files/)) {
- setTimeout(function () {
- GRACEFUL.apply(fs, args)
- }, timeout ++)
- return
- }
- timer = 0
- cb_.apply(null, arguments)
- }
- fn.apply(fs, args)
-}}
View
0  support/jsftp → node_modules/jsftp
File renamed without changes
View
0  support/node-sftp → node_modules/node-sftp
File renamed without changes
View
9 package.json
@@ -5,12 +5,19 @@
"homepage" : "http://github.com/mikedeboer/jsDAV",
"engines": {"node": ">= 0.4.0"},
"author": "Mike de Boer <info@mikedeboer.nl>",
- "scripts": {"test": "node test/test_server.js"},
+ "scripts": {
+ "test": "node test/test_server.js"
+ },
"main": "lib/jsdav",
"repository" : {
"type" : "git",
"url" : "http://github.com/mikedeboer/jsDAV.git"
},
+ "dependencies": {
+ "asyncjs": "0.0.5",
+ "formidable": "1.0.8",
+ "libxml": "0.0.3"
+ },
"licenses": [{
"type": "The MIT License",
"url": "http://www.opensource.org/licenses/mit-license.php"}
1  support/async.js
@@ -1 +0,0 @@
-Subproject commit 92fb710a70efd3cdc2376ebfba71a7fb3a4f1651
1  support/formidable
@@ -1 +0,0 @@
-Subproject commit a37292d4b7d6d76a38909ed670334c9068d40871
1  support/node-o3-xml-v4
@@ -1 +0,0 @@
-Subproject commit b0b5676e83b97d95b94b490001dde68eb0c0e053
View
42 test/test_filelist.js
@@ -0,0 +1,42 @@
+"use strict";
+
+var Http = require("http");
+var Async = require("./../node_modules/asyncjs");
+
+var options = {
+ host: "localhost",
+ port: 8000,
+ method: "REPORT",
+ path: "/"
+};
+
+Async.range(1, 1000)
+ .each(function(num) {
+ var req = Http.request(options, function(res) {
+ if (res.statusCode != 207)
+ return next("Invalid status code! " + res.statusCode);
+
+ console.log("[" + num + "] status: " + res.statusCode);
+ //console.log("[" + num + "] headers: " + JSON.stringify(res.headers));
+ res.setEncoding("utf8");
+ res.on("data", function(chunk) {
+ console.log("[" + num + "] body: " + chunk);
+ });
+
+ res.on("end", function() {
+ //next();
+ });
+ });
+
+ req.on("error", function(e) {
+ console.log("problem with request: " + e.message);
+ });
+
+ // write data to request body
+ req.write('<?xml version="1.0" encoding="utf-8" ?>\n');
+ req.write('<D:filelist xmlns:D="DAV:"></D:filelist>');
+ req.end();
+ })
+ .end(function(err) {
+ console.log("DONE");
+ });
View
2  test/test_ftp.js
@@ -219,4 +219,4 @@ process.on("exit", function() {
module.exports.conn.end();
});
-!module.parent && require("./../support/async.js/lib/test").testcase(module.exports, "FTP"/*, timeout*/).exec();
+!module.parent && require("./../node_modules /asyncjs/lib/test").testcase(module.exports, "FTP"/*, timeout*/).exec();
View
5 test/test_mount.js
@@ -7,14 +7,13 @@
*/
"use strict";
-var Sys = require("sys"),
- Http = require("http"),
+var Http = require("http"),
jsDAV = require("./../lib/jsdav");
jsDAV.debugMode = true;
var server = Http.createServer(function(req, resp) {
- Sys.puts("Incoming request in other handler...");
+ console.log("Incoming request in other handler...");
});
server.listen(8080, "127.0.0.1");
View
15 test/test_statfs.js
@@ -7,29 +7,28 @@
*/
"use strict";
-var sys = require("sys"),
- fs = require("fs");
+var fs = require("fs");
var s = fs.statvfsSync("/");
-sys.puts("statvfsSync Free: " + formatSize(s.bfree * s.bsize) + " " + JSON.stringify(s));
+console.log("statvfsSync Free: " + formatSize(s.bfree * s.bsize) + " " + JSON.stringify(s));
var fd = fs.openSync(__filename, "r", 0666);
s = fs.fstatvfsSync(fd);
-sys.puts("fstatvfsSync Free: " + formatSize(s.bfree * s.bsize) + " " + JSON.stringify(s));
+console.log("fstatvfsSync Free: " + formatSize(s.bfree * s.bsize) + " " + JSON.stringify(s));
fs.statvfs("/", function(err,s) {
if (err) {
- sys.puts("statvfs error: " + err);
+ console.log("statvfs error: " + err);
return;
}
- sys.puts("statvfs Free: " + formatSize(s.bfree * s.bsize) + " " + JSON.stringify(s));
+ console.log("statvfs Free: " + formatSize(s.bfree * s.bsize) + " " + JSON.stringify(s));
});
fs.fstatvfs(fd, function(err,s) {
if (err) {
- sys.puts("fstatvfs error: " + err);
+ console.log("fstatvfs error: " + err);
return;
}
- sys.puts("fstatvfs Free: " + formatSize(s.bfree * s.bsize) + " " + JSON.stringify(s));
+ console.log("fstatvfs Free: " + formatSize(s.bfree * s.bsize) + " " + JSON.stringify(s));
});
function formatSize(n) {
View
15 test/test_xml.js
@@ -9,7 +9,6 @@
var Util = require("./../lib/DAV/util"),
Assert = require("assert"),
- sys = require("sys"),
K = function() {},
onStartDocument = K,
@@ -31,33 +30,33 @@ function setUp() {
onEndDocument();
});
cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
- sys.puts("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
+ console.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
onStartElementNS(elem, attrs, prefix, uri, namespaces);
});
cb.onEndElementNS(function(elem, prefix, uri) {
- sys.puts("<= End: " + elem + " uri="+uri + "\n");
+ console.log("<= End: " + elem + " uri="+uri + "\n");
onEndElementNS(elem, prefix, uri);
parser.pause();// pause the parser
setTimeout(function (){parser.resume();}, 100); //resume the parser
});
cb.onCharacters(function(chars) {
- sys.puts('<CHARS>'+chars+"</CHARS>");
+ console.log('<CHARS>'+chars+"</CHARS>");
onCharacters(chars);
});
cb.onCdata(function(cdata) {
- sys.puts('<CDATA>'+cdata+"</CDATA>");
+ console.log('<CDATA>'+cdata+"</CDATA>");
onCdata(cdata);
});
cb.onComment(function(msg) {
- sys.puts('<COMMENT>'+msg+"</COMMENT>");
+ console.log('<COMMENT>'+msg+"</COMMENT>");
onComment(msg);
});
cb.onWarning(function(msg) {
- sys.puts('<WARNING>'+msg+"</WARNING>");
+ console.log('<WARNING>'+msg+"</WARNING>");
onWarning(msg);
});
cb.onError(function(msg) {
- sys.puts('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
+ console.log('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
onError(msg);
});
});
Something went wrong with that request. Please try again.