Giter Site home page Giter Site logo

mikedeboer / jsdav Goto Github PK

View Code? Open in Web Editor NEW
683.0 50.0 159.0 2.13 MB

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.

Home Page: http://www.mikedeboer.nl

License: MIT License

JavaScript 99.85% Shell 0.15%

jsdav's Introduction

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

  • Fully WebDAV compliant
  • Supports Windows XP, Windows Vista, Mac OS/X, DavFSv2, Cadaver, Netdrive, Open Office, and probably more
  • Supporting class 1, 2 and 3 Webdav servers
  • Custom property support
  • Locking support
  • Pass all Litmus tests

Features in development

  • CalDAV (to be tested with Evolution, iCal, iPhone and Lightning).

Supported RFC's

  • RFC2617: Basic/Digest auth
  • RFC2518: First WebDAV spec
  • RFC5689: Extended MKCOL
  • CardDAV (to be tested with the iOS addressbook and Evolution)

RFC's in development

  • RFC4918: WebDAV revision
  • CalDAV ctag, CalDAV-proxy

See the wiki for more information or ask a question in the mailing list!

Amsterdam, 2010. Mike de Boer.

jsdav's People

Contributors

0x7f avatar addrummond avatar aenario avatar alexzhuustc avatar bancek avatar bedney avatar cadorn avatar dlaxar avatar fjakobs avatar fnd avatar foundrytom avatar giannis avatar gjtorikian avatar janjongboom avatar joernroeder avatar johnsonlee avatar marijnh avatar mattpardee avatar mikedeboer avatar olegas avatar paroga avatar pure avatar rendez avatar rikarends avatar rksm avatar sergi avatar tanepiper avatar woutervroege avatar ykumar6 avatar zefhemel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsdav's Issues

FTP backend functional?

I am trying to use FTP backend with jsDAV. The only code reference I could find is test_ftp.js, which had credentials portion commented out & possibly other things mocked out.

Are there any working sample or code pointers on FTP backend? Any help would be appreciated!

Thanks!

jsDAV installed throung 'npm install jsDAV' will report warning

[root@linuxdev test]# node test_server.js
The "sys" module is now called "util". It should have a similar interface.
[info] jsDAV server running on http://127.0.0.1:8000

--== The Problem ==--
node always report below warning when running jsDAV
"The "sys" module is now called "util". It should have a similar interface."

--== Root Cause ==--
Some dependence code still use 'require "sys"'.

[root@linuxdev jsDAV]# grep -R "require.*sys" *
lib/DAV/server.js:var jsDAV_Tree_Filesystem = require("./tree/filesystem").jsDAV_Tree_Filesystem;
node_modules/formidable/Readme.md: sys = require('sys');
node_modules/formidable/lib/util.js: module.exports = require('sys');
node_modules/libxml/support/o3/modules/fastxml/test/test.js:var sys = require('sys');
node_modules/libxml/support/o3/modules/xml/test/test.js:var sys = require('sys');
Binary file node_modules/libxml/support/o3/build/Release/hosts/node-o3/sh_node_1.o matches
Binary file node_modules/libxml/support/o3/build/Release/o3.node matches
Binary file node_modules/libxml/lib/libxml/o3.node matches
node_modules/asyncjs/lib/plugins/fs-node.js:var sys = require("sys")
node_modules/asyncjs/lib/test.js:var sys = require("sys")

--== The Solution ==--
The warning is caused by dependence modules: asyncjs, formidable
Update jsDAV package.json to use latest asyncjs and formidable would remove this warning.
Currently the latest version are

I have tested it. The warning will gone.

upload file from browser doesnt work

I've tried to upload a file from a browser, but jsDav reply is the following

<?xml version="1.0" encoding="utf-8"?>
[info] <d:error xmlns:d="DAV:" xmlns:a="http://ajax.org/2005/aml">
[info]     <a:exception>NotImplemented</a:exception>
[info]     <a:message>NotImplemented</a:message>
[info] <a:file></a:file>
[info] <a:line></a:line>
[info] <a:jsdav-version>0.3.2</a:jsdav-version>
[info] </d:error>'`

after a little bit of debuggin I've discovered that the POST method is not handled properly
at line 151 of httpPOSTHandler method in browser.js

var postVars = Qs.parse(body);
if (!postVars.jsdavAction)
                return e.next();

the expression if (!postVars.jsdavAction) returns true then in handler.js at line 243

this.dispatchEvent("beforeMethod", method, uri, function(stop) {
            if (stop === true)
                return;
            if (stop)
                return self.handleError(stop);
            // Make sure this is a HTTP method we support
            if (internalMethods[method]) {
                self["http" + method.charAt(0) + method.toLowerCase().substr(1)]();
            }
            else {
                self.dispatchEvent("unknownMethod", method, uri, function(stop) {
....

stop is undefined and then the else part is executed.
Probably the issue in in the querystring module of nodejs.

I'm using master-branch and node 0.8.2

Creating new web folder connection on Win XP fails with master head

When I am running test/test_server.js from the head from master which includes the locking functionality, I get an exception in Windows XP Professional when trying to initially create a new web folder connection to the WebDAV server. The failure prevents the WebDAV server from appearing in My Network, so effectively prevents it from being used if not previously created.

However if I am running v0.1.1 (the version without locking support) then I can create a Web folder using the same process.

Once the web folder had been previously created and shows up in My Network, then I can access the WebDAV folder in both v 0.1.1 and the head version. So the problem only occurs when trying to initially create the Web Folder.

The error brings up a crash dialog with

AppName: rundll32.exe AppVer: 5.1.2600.5512 ModName: shell32.dll
ModVer: 6.0.2900.6072 Offset: 0002b234

https://gist.github.com/1217773

Below is the debug log from head (v0.1.2) which fails
https://gist.github.com/1217782

Here is the debug log from v0.1.1 (without locking) which works (for comparison)
https://gist.github.com/1217784

The net result is that unless you have previously created a web folder using v0.1.1 I could not find a way to create it when using the latest version.

I'm hoping the debug logs from both versions will make this easy to figure out.

Thanks.

expections.js - error triggered on require

requiring the exceptions module incorrectly triggers an "Error".

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error
at Object. (/home/ubuntu/initme_agent/jsDAV/lib/DAV/exceptions.js:82:37)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/home/ubuntu/initme_agent/jsDAV/lib/DAV/server.js:14:14)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)

Problem writing new files when mounted as share in OS X (10.7.4)

Steps to reproduce problem:

  1. Run test/test_server.js

  2. Mount folder using finder.

  3. cd /Volumes/localhost followed by echo sometext > newfile.

At this point, on my system (OS X 10.7.4), both Finder and Terminal then hang, and I have to kill the node process using Activity Monitor. It seems that the file itself is created and the data is written to it, but there is some problem caused by the PROPFIND or UNLOCK requests which the OS X webdav implementation makes following creation of the new file. I haven't figured it out exactly yet.

If newfile is replaced by the name of an existing file, the problem does not seem to arise.

Error: Cannot find module './../plugins/locks/lockInfo'

(when starting cloud9...)
bin/cloud9.sh

node.js:63
throw e;
^
Error: Cannot find module './../plugins/locks/lockInfo'
at loadModule (node.js:475:15)
at require (node.js:611:14)
at Object. (/home/xantus/git-repos/cloud9/common/jsdav/lib/DAV/property/lockDiscovery.js:12:28)
at Module._compile (node.js:662:23)
at Module._loadScriptSync (node.js:669:10)
at Module.loadSync (node.js:538:12)
at loadModule (node.js:483:14)
at require (node.js:611:14)
at Object. (/home/xantus/git-repos/cloud9/common/jsdav/lib/DAV/plugins/locks.js:12:36)
at Module._compile (node.js:662:23)

It loaded fine after I changed lockInfo to lockinfo on L12 of lib/DAV/property/lockDiscovery.js

Object inheritance system breaks once there are enough classes

I'm experimenting with adding another backend to this project and ran into a bug that I've tracked down.

In lib/shared/base.js, classes (prototypes) are assigned a UUID that's essentially, 2^n. When n becomes too large because there are too many classes, the calculated "uuid" becomes a duplicate. That's because in node, 1 << 32 == 1.

This results in the hasFeature function returning the wrong result sometimes.

If this is not clear, please let me know and I'll explain further.

Integration into an existing app

I have an existing app that stores files in GridFS (mongodb) and I was really struggling to get jsDAV to play nice with the app. I couldn't figure out how to easily access the application. For example after a write I may need to emit socket.io messages, update the users available space and charge the users cc if they need to purchase more space. To solve this I have started working on a new server type that will take a handler object that implements all of the necessary authentication/read/write logic.

Is there a better way to do this?

https://github.com/respectTheCode/jsDAV

CardDAV example

Hi,
The README mention CardDAV but there is no documentation on it and the examples folder contain only empty files... (seriously you should remove the examples folder in this state).
Is there an example somewhere of a basic CardDAV setup ?

I wanted to do some tests but I cannot even make it work :/

install failed with 8 on raspbian

Hello,
I did not get jsDAV installed.
Here is the commandline printout:

root@raspberrypi ~ $ uname -a
Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l GNU/Linux

root@raspberrypi:~# npm install jsDAV
npm http GET https://registry.npmjs.org/jsDAV
npm http 200 https://registry.npmjs.org/jsDAV
npm http GET https://registry.npmjs.org/jsDAV/-/jsDAV-0.3.1.tgz
npm http 200 https://registry.npmjs.org/jsDAV/-/jsDAV-0.3.1.tgz
npm http GET https://registry.npmjs.org/asyncjs
npm http GET https://registry.npmjs.org/gnu-tools
npm http GET https://registry.npmjs.org/dbox
npm http GET https://registry.npmjs.org/formidable
npm http GET https://registry.npmjs.org/redis
npm http GET https://registry.npmjs.org/jsftp
npm http GET https://registry.npmjs.org/mongodb
npm http GET https://registry.npmjs.org/node-sftp/0.1.1
npm http GET https://registry.npmjs.org/xmldom
npm http GET https://registry.npmjs.org/xpath
npm http 200 https://registry.npmjs.org/asyncjs
npm http 200 https://registry.npmjs.org/gnu-tools
npm http 200 https://registry.npmjs.org/formidable
npm http 200 https://registry.npmjs.org/jsftp
npm http 200 https://registry.npmjs.org/dbox
npm http 200 https://registry.npmjs.org/node-sftp/0.1.1
npm http 200 https://registry.npmjs.org/redis
npm http 200 https://registry.npmjs.org/xpath
npm http 200 https://registry.npmjs.org/xmldom
npm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.14.tgz
npm http GET https://registry.npmjs.org/jsftp/-/jsftp-0.5.9.tgz
npm http GET https://registry.npmjs.org/dbox/-/dbox-0.5.7.tgz
npm http GET https://registry.npmjs.org/redis/-/redis-0.8.3.tgz
npm http GET https://registry.npmjs.org/xpath/-/xpath-0.0.5.tgz
npm http GET https://registry.npmjs.org/node-sftp/-/node-sftp-0.1.1.tgz
npm http GET https://registry.npmjs.org/xmldom/-/xmldom-0.1.16.tgz
npm http GET https://registry.npmjs.org/asyncjs/-/asyncjs-0.0.9.tgz
npm http GET https://registry.npmjs.org/gnu-tools/-/gnu-tools-0.0.8.tgz
npm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.14.tgz
npm http 200 https://registry.npmjs.org/jsftp/-/jsftp-0.5.9.tgz
npm http 200 https://registry.npmjs.org/dbox/-/dbox-0.5.7.tgz
npm http 200 https://registry.npmjs.org/node-sftp/-/node-sftp-0.1.1.tgz
npm http 200 https://registry.npmjs.org/xmldom/-/xmldom-0.1.16.tgz
npm http 200 https://registry.npmjs.org/xpath/-/xpath-0.0.5.tgz
npm http 200 https://registry.npmjs.org/mongodb
npm http 200 https://registry.npmjs.org/redis/-/redis-0.8.3.tgz
npm http 200 https://registry.npmjs.org/asyncjs/-/asyncjs-0.0.9.tgz
npm http 200 https://registry.npmjs.org/gnu-tools/-/gnu-tools-0.0.8.tgz
npm http GET https://registry.npmjs.org/mongodb/-/mongodb-1.2.14.tgz
npm http 200 https://registry.npmjs.org/mongodb/-/mongodb-1.2.14.tgz
npm WARN package.json [email protected] No README.md file found!
npm http GET https://registry.npmjs.org/request/2.9.153
npm http 200 https://registry.npmjs.org/request/2.9.153
npm http GET https://registry.npmjs.org/request/-/request-2.9.153.tgz
npm http 200 https://registry.npmjs.org/request/-/request-2.9.153.tgz
npm http GET https://registry.npmjs.org/streamer
npm http 200 https://registry.npmjs.org/streamer
npm http GET https://registry.npmjs.org/streamer/-/streamer-0.2.1.tgz
npm http 200 https://registry.npmjs.org/streamer/-/streamer-0.2.1.tgz
npm http GET https://registry.npmjs.org/bson/0.1.8
npm http 200 https://registry.npmjs.org/bson/0.1.8
npm http GET https://registry.npmjs.org/bson/-/bson-0.1.8.tgz
npm http 200 https://registry.npmjs.org/bson/-/bson-0.1.8.tgz

[email protected] install /root/node_modules/jsDAV/node_modules/mongodb/node_modules/bson
(node-gyp rebuild 2> builderror.log) || (exit 0)

[email protected] postinstall /root/node_modules/jsDAV/node_modules/gnu-tools
node ./install.js

module.js:340
throw err;
^
Error: Cannot find module '/root/node_modules/jsDAV/node_modules/gnu-tools/install.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
npm ERR! [email protected] postinstall: node ./install.js
npm ERR! sh "-c" "node ./install.js" failed with 8
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the gnu-tools package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls gnu-tools
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.6.11+
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "jsDAV"
npm ERR! cwd /root
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/npm-debug.log
npm ERR! not ok code 0

jsDAV_ObjectTree doesn't work

There is a coding issue causing jsDAV_ObjectTree cannot work.

jsDAV_ObjectTree.js line:47

  • Async.range(i, l - 1)
  • Async.list(c)

Currently, this bug cause getNodeForPath() always return rootNode.

Another tiny bug is in jsDAV.js line:58

  • throw new Error("Could not implement from '" + classRef[i] + "'");
  • throw new Error("classRef is not set");

classRef and i was null when code runs to here. classRef[i] is illegal.

inconsistencies between windows and linux versions of node running jsDAV

The latest version of jsDAV returns different results when obtaining a list of all files in the mount directory. I have tested this using both an HTTP GET and using PROPFIND. Below is an example of the difference in jsDAV running on node for linux and node for windows(native node binary NOT cygwin)

Linux example:
webdav directory: "/media/internal"
files in /media/internal: file1, file2
GET result:
file1 < type> < size>
file2 < type> < size>

Windows example:
webdav directory: "/Document and Settiings/user/My Documents"
files in /Document and Settiings/user/My Documents: file1, file2
GET result:
/Document and Settiings/user/My Documents/file1 < type> < size>
/Document and Settiings/user/My Documents/file2 < type> < size>

when a link is clicked (say file1 link) in the windows versions the link directs to
"/Document and Settiings/user/My Documents\Document and Settiings\user\My Documents\file"

instead of : "/Document and Settiings/user/My Documents/file"

In the linux version the mount directory is referenced as "/" so really clicking the file1 link in windows to be consistent with the linux version should direct to "/file1 "

examples > 0 bytes?

The examples all seem to be empty files... do they exist anywhere? Do they need to be created?

Returning jsDAV_Exception_Forbidden

Hi,

First of all, thanks for the great library.

I'm trying to implement file permissions and returning jsDAV_Exception_Forbidden
on a Directory createFile, but the 403 response is not appearing and node says:

This type of response MUST NOT have a body. Ignoring data passed to end().

If I find the problem, I will send a pull request.

Found Bug

I found the following bug while testing:

handler.js line:451

body.copy(newStream, offlen, start);

gives:
Error: targetStart out of bounds

should be:
body.copy(newStream, start, offlen);

I tested this and it fixed my error.

codesearch.js is hard-coded to use bash

codesearch is hard-coded to use bash and at my work, we don't have bash. i realize that bash is quite common so i understand why it would be chosen. however i was wondering if there is a shell that is more common or alternatively a way to fork the logic based on what shells are available or if this feature could be implemented without referencing any shell.

in my case, csh is available and so i've patched codesearch to work with csh.

diff --git a/lib/DAV/plugins/codesearch.js b/lib/DAV/plugins/codesearch.js
index 9d3f77b..d961af0 100644
--- a/lib/DAV/plugins/codesearch.js
+++ b/lib/DAV/plugins/codesearch.js
@@ -152,12 +152,12 @@ jsDAV_Codesearch_Plugin.MAXSIZE = 2097152; //2MB
         if (!Util.isTrue(options.casesensitive))
             cmd += " -i ";
         var t,
-            include = "*.{" + jsDAV_Codesearch_Plugin.PATTERN_EXT + "}";
+            include = "\\*.{" + jsDAV_Codesearch_Plugin.PATTERN_EXT + "}";
         if (!Util.empty(options.pattern) && (t = jsDAV_Codesearch_Plugin.MAPPINGS[options.pattern]))
-            include = (t.length > 1 ? "*.{" : "*.") + t.join(",") + (t.length > 1 ? "}" : "");
+            include = (t.length > 1 ? "\\*.{" : "\\*.") + t.join(",") + (t.length > 1 ? "}" : "");
         if (options.maxresults)
             cmd += "-m " + parseInt(options.maxresults);
-        cmd += " --exclude=*{" + jsDAV_Codesearch_Plugin.PATTERN_EDIR + "}*"
+        cmd += " --exclude=\\*{" + jsDAV_Codesearch_Plugin.PATTERN_EDIR + "}\\*"
             +  " --include=" + include + " \""
             + Util.escapeShell(options.query)
             + "\" \"" + node.path + "\"";
@@ -166,7 +166,7 @@ jsDAV_Codesearch_Plugin.MAXSIZE = 2097152; //2MB

         var out  = "",
             err  = "",
-            grep = Spawn("/bin/bash", ["-c", cmd]);
+            grep = Spawn("/bin/csh", ["-c", cmd]);

         grep.stdout.setEncoding("utf8");
         grep.stderr.setEncoding("utf8");

i'm just including this for reference in case you thought csh might be more widely available or if you wanted to implement the search based on what shells are available.

ParseFromString does not work

I have been trying to perform a PROFIND I order to get a list of all files and I am getting the following error

The request body had an invalid XML body. (Message: Cannot call method 'ParseFromString' of undefined)

My request contains the following xml:

 <propfind xmlns="DAV:">  
     <propname />
 </propfind>

Just FYI this works using lighttpd as my server, so I know the code works it. So my guess it is a bug in your code.

Cannot Write from OS X

A minimal jsDAV server does not write files when mounted on OS X. I've attached the minimal server code and the output from debug when mounting the volume and copying a small text file to the root directory. Not sure what more I can add.

locking timeout does not work properly

in jsDAV/lib/DAV/plugins/locks/fs.js the timeout for locks is defined as

// We're making the lock timeout 30 minutes
lockInfo.timeout = 1800;

so the value is in seconds.

but when it is used, it is compared in function getlocks, it is compared against values that are in milliseconds:

if (Date.now() > lock.timeout + lock.created)

so the timeout happens after 1,8 seconds.

the easiest fix should be changing the comparison not changing the variable, since the timeout is also sent to the client as a seconds value:

if (Date.now() > (lock.timeout * 1000) + lock.created)

Just a note

I was looking through your code and in the main jsDav file, it looks like there is an undefined variable:

classRef[i] on ~ line 58

In your first parameter check.

Error when accessing via client

I'm using Ubuntu, when i try to access via client (i tried LibreOffice and filesystem mount "sudo mount.davfs -t "http://localhost:8000" "FOLDER") I get the following error:

jsDAV server running on '127.0.0.1' port 8000
INFO: invoking method 'GET'
INFO: sending header: 200, { 'Content-Type': 'text/html; charset=utf-8' }
INFO: writing body: '

... some html...

argument after event: true
INFO: invoking method 'OPTIONS'
argument after event: null
INFO: sending header: 200, { Allow: 'OPTIONS,GET,HEAD,DELETE,PROPFIND,PUT,PROPPATCH,COPY,MOVE,REPORT',
'MS-Author-Via': 'DAV',
'Accept-Ranges': 'bytes',
'X-jsDAV-Version': undefined,
'Content-Length': 0,
DAV: '1,3,extended-mkcol,2' }
INFO: writing body: 'undefined'
INFO: invoking method 'PROPFIND'
argument after event: null
INFO: data received
propfind xmlns="DAV:">
getetag xmlns="DAV:"/>
getcontentlength xmlns="DAV:"/>
creationdate xmlns="DAV:"/>
getlastmodified xmlns="DAV:"/>
resourcetype xmlns="DAV:"/>
executable xmlns="http://apache.org/dav/props/"/>
/prop>

Segmentation fault

NOTE: OPENING TAGS OF XML REMOVED MANUALLY FOR THIS POST

Followed the problem down to the o3-xml library. Is this a bug or do I have a wrong understanding of the capabilities of jsDAV?

win32 wrong path's in browser client

when running jsDAV on win32, the browser-client-assets do not work correctly. All path's are displayed with the complete directory (eg c:/document and settings/username/where/i/started/app/js) instead of the relative path (mountpoint/mypath)
This behavior differs significant from the unix/linux instance

<td><a href="/userdata/7c90f031c4cbe2e/c:%255Csome%255Cvar%255Ctmp%255Cpath%255Cuserdata%255C7c90f031c4cbe2e%255Cabc">c:%5Csome%5Cvar%5Ctmp%5Cpath%5Cuserdata%5C7c90f031c4cbe2e%5Cabc</a></td>

instead of

<td><a href="/userdata/7c90f031c4cbe2e/abc">abc</a></td>

jsDAV 0.3.2 (c)

Example caldav server

We have a couple example, "standalone" servers using jsDAV in examples/ and it would be nice to add one that does calendaring.

jsDAV and node 0.10

jsDAVs liberal use of Object.freeze breaks lots of things when really enforced as in node 0.10. E.g. try to start examples/fileserver.js and an error will be thrown in lib/shared/base.js line 78. Imo it makes little sense to have extend() in shared/base freeze Objects by default.

uploading tree fails with "the specified path is not a folder" in Coda

Uploading directories of any complexity in Coda fails usually at the first subfolder with "Could not change directory to '...'" The specified path is not a folder."

Uploading the same folder works using Panic's Transmit or CyberDuck. It also works for Coda using SabreDAV. jsDAV fails with Coda though under both node v0.8.16 and v0.7.12

I'll start digging deeper myself when I have some time but was wondering if anyone else has seen or worked on this issue yet as it seems hard to miss but I couldn't find any past discussions.

Screen Shot 2013-01-01 at 2 53 35 PM

Screen Shot 2013-01-01 at 2 53 46 PM

Only works in 127.0.0.1 address

I installed successfully by npm, but, only works on 127.0.0.1:8000 address, even using the LAN ip address on the server computer is not working.

Any help?

How to add a plugin?

The jsDAV server seems to support 'plugins', but I have not been able to figure out how to get them to work.

I tried adding an options.plugins but once I read the code it seems that this object is some sort of filter on the DEFAULT_PLUGINS (that alone is very confusing).

Then I tried

jsDAV.createServer({
    node: __dirname + "/..",
    locksBackend: new jsDAV_Locks_Backend_FS(__dirname + "/jsDAV_locks_8686")
}, 8686).plugins.CORS_Plugin = jsDAV_CORS_Plugin;

No luck. I could not find any doc pages or online info.

Trying to get the head of a directory results in TypeError

the specific error I received was this. I my code accidentally tried to get the head a directory instead of a file.

/lib/DAV/handler.js:547
node.get(function(err, body)
^
TypeError: Object [object Object] has no method 'get'
at /lib/DAV/handler.js:547:9
at /lib/DAV/tree/filesystem.js:47:19
at node.js:28:97

looking into the error further showed that since the request was for a directory the node returned was a "jsDAV_FS_Directory" which has no "get" method. Usually a "jsDAV_FS_File" is returned, which does have a get method.

What clients has jsDAV been tested against?

I'm curious as to what WebDAV clients (and versions of them) this module has been tested against?

An experienced developer who's tried to make WebDAV work just told me that "the intersection where all webdav clients out there work the same is virtually null."

OS X client breaks on apostrophe

I've found that if the host machine has a directory with an apostrophe, the OS X client will only show the name up to (but not including) the apostrophe in the mounted filesystem. This means when you try to enter the directory, OS X requests the truncated name (which doesn't exist on the server) and gets an access error. For example, a directory named "I'm sure this will work" shows up on the Mac as "I". Apparently apostrophes are not encoded by encodeURI, and OS X needs them to be encoded.

temporaryfilefilter.js calls cleanup() but it is undefined

Using node v0.6.11 on OSX, installed jsDAV from current source and ran "node test/test_server.js". I get below error when navigating via Finder. The following simple change fixes error but not sure if it's right fix.

diff --git a/lib/DAV/plugins/temporaryfilefilter.js b/lib/DAV/plugins/temporaryfilefilter.js
index 5f2ba40..c71204f 100644
--- a/lib/DAV/plugins/temporaryfilefilter.js
+++ b/lib/DAV/plugins/temporaryfilefilter.js
@@ -200,7 +200,8 @@ function jsDAV_TemporaryFileFilter_Plugin(handler) {
                 if (err)
                     return e.next(err);
                 Fs.writeFile(tempLocation, body, "binary", function(err) {
-                    cleanup();
+           if (cleanup)
+           cleanup();
                     if (err)
                         return e.next(err);

[error] argument after event 'unknownmethod': true
[info] REQUEST START: /walk/.DS_Store 127
[info] invoking method 'PROPFIND' 127
[info] sending header: 404 { 'Content-Type': 'application/xml; charset=utf-8' }
[info] request end: 127
[info] writing body: '
[info] <d:error xmlns:d="DAV:" xmlns:a="http://ajax.org/2005/aml">
[info] <a:exception>jsDAV_Exception_FileNotFound/a:exception
[info] <a:message>File at location /Users/jamshid/src/jsDAV/test/assets/walk/.DS_Store not found/a:message
[info] <a:file>/a:file
[info] <a:line>/a:line
[info] <a:jsdav-version>0.1.2/a:jsdav-version
[info] /d:error'
[error] { code: 404,
[error] type: 'jsDAV_Exception_FileNotFound',
[error] message: 'File at location /Users/jamshid/src/jsDAV/test/assets/walk/.DS_Store not found' }
[info] REQUEST START: /walk/.DS_Store 128
[info] invoking method 'PUT' 128

/Users/jamshid/src/jsDAV/lib/DAV/plugins/temporaryfilefilter.js:204
cleanup();
^
TypeError: undefined is not a function
at /Users/jamshid/src/jsDAV/lib/DAV/plugins/temporaryfilefilter.js:204:4
at Object.oncomplete (fs.js:608:21)

a way to save a base64 buffer for images

fs = require('fs');
sys = require('sys');
// string generated by canvas.toDataURL()
var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0"
    + "NAAAAKElEQVQ4jWNgYGD4Twzu6FhFFGYYNXDUwGFpIAk2E4dHDRw1cDgaCAASFOffhEIO"
    + "3gAAAABJRU5ErkJggg==";
// strip off the data: url prefix to get just the base64-encoded bytes
var data = img.replace(/^data:image\/\w+;base64,/, "");
var buf = new Buffer(data, 'base64');
fs.writeFile('image.png', buf);

a way to save a base64 buffer for images like above example ^^

content-length and accept-ranges header not in httpHead

I have been using ranges a lot and had to modify the httpHead to include both content-length and accept-ranges headers. These are both returned by lighttpd when a httpHead is requested. Here is my code for including these headers. I had to include a node.get which breaks if it encounters a directory so it should throw an http error code in that situation.

there may be a better way than using a node.get but this does work.

his.httpHead = function() {
var uri = this.getRequestUri(),
_self = this;
this.server.tree.getNodeForPath(uri, function(err, node) {
if (!Util.empty(err))
return _self.handleError(err);
/* This information is only collection for File objects.
* Ideally we want to throw 405 Method Not Allowed for every
* non-file, but MS Office does not like this
*/
node.get(function(err, body) //I added
{
var headers = {};

            if (node.hasFeature(jsDAV.__IFILE__)) 
            {
                _self.getHTTPHeaders(uri, function(err) {
                    if (!Util.empty(err))
                        return _self.handleError(err);
                    if (!headers["Content-Type"])
                        headers["Content-Type"] = "application/octet-stream";
                        headers["Content-Length"] = body.length; // just get size not entire body
                        headers["Accept-Ranges"] = "bytes";                         
                    afterHeaders(headers);
                });
            }
            else {
                afterHeaders();
            }
        });

Updating MS Word doc on OS X fails

When using MS Word for Mac 2011 (v 14.1.2 110505) to write to drive, sometimes it fails.

I have not been able to pin down when it will work and when it will fail.

Usually the initial save will work, but then when updating, it may work or it may fail. Sometimes it will work but is just really slow (maybe 5 minutes to write a small 22K file with only a few words in it).

I also see lots of .lock files starting to appear in the directory as time goes on.

It seems like maybe locks or unlocks are timing out in Word??

Here is a link to the debug output where the initial write works, but then an update failed.

https://gist.github.com/1212572

Thanks in advance for your help and work on this project! It is a great module for Node.js.

Large files cause jsDAV to hard shutdown

I have been uploading large files (>2GB) and the files seem to complete, but at the very end of the transfer, I get a 502 Bad Gateway in my webDAV client.

Looking at std out shows that jsDAV has in fact killed itself.

Here's the output right before jsDAV outputs "Killed"

[info] {358} PROPFIND /
[info] {358} { host: 'localhost:9000',
[info]   connection: 'close',
[info]   'content-length': '179',
[info]   'content-type': 'text/xml',
[info]   depth: '0',
[info]   accept: '*/*',
[info]   'user-agent': 'WebDAVFS/3.0.0 (03008000) Darwin/13.0.0 (x86_64)' }
[info] Receiving headers: {"host":"localhost:9000","connection":"close","content-length":"179","content-type":"text/xml","depth":"0","accept":"*/*","user-agent":"WebDAVFS/3.0.0 (03008000) Darwin/13.0.0 (x86_64)"}
[info] Returning headers: {"Access-Control-Allow-Methods":"GET, HEAD, PUT, POST, DELETE, TRACE, OPTIONS, CONNECT, PATCH, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, VERSION-CONTROL, REPORT, CHECKOUT, CHECKIN, UNCHECKOUT, MKWORKSPACE, UPDATE, LABEL, MERGE, BASELINE-CONTROL, MKACTIVITY, GETLIB","Access-Control-Max-Age":"86400","Access-Control-Allow-Headers":["accept","accept-charset","accept-encoding","accept-language","authorization","content-length","content-type","host","origin","proxy-connection","referer","user-agent","x-requested-with"],"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Origin":"*"}
[info] {358} <?xml version="1.0" encoding="utf-8"?>
[info] <D:propfind xmlns:D="DAV:">
[info] <D:prop>
[info] <D:getlastmodified/>
[info] <D:getcontentlength/>
[info] <D:creationdate/>
[info] <D:resourcetype/>
[info] </D:prop>
[info] </D:propfind>
[info]
[info] {358} 207 { 'content-type': 'application/xml; charset=utf-8',
[info]   vary: 'Brief,Prefer',
[info]   DAV: '1,3,extended-mkcol,2' }
[info] {358} '<?xml version="1.0" encoding="utf-8"?><d:multistatus xmlns:d="DAV:" xmlns:a="http://ajax.org/2005/aml"><d:response><d:href>/</d:href><d:propstat><d:prop><d:getlastmodified xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/" b:dt="dateTime.rfc1123">Mon, 12 Aug 2013 17:37:10 -0700</d:getlastmodified><d:getcontentlength></d:getcontentlength><d:creationdate></d:creationdate><d:resourcetype><d:collection/></d:resourcetype></d:prop><d:status>HTTP/1.1 200 Ok</d:status></d:propstat></d:response></d:multistatus>'
Killed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.