webrick-webdav(gem) served files are mounted only read-only

  • Thread starter Dirk Lüsebrink
  • Start date
D

Dirk Lüsebrink

while i easily get a webdav server up an running with

gem install webrick-webdav

and

require 'webrick'
require 'webrick/httpservlet/webdavhandler'

server = WEBrick::HTTPServer.new(context.values)
server.mount("/webdav", WEBrick::HTTPServlet::WebDAVHandler, Dir.pwd)
...

and can mount and read the files, i still can't actually modify any of
the exported/mounted webdav files.

before i start diving into real problem tracking i would like to ask if
someone of you had the same problems? i export/mount on mac os x. might
this be a mac or a webrick-webdav problem? any tips welcomed,

have fun
dirk
 
G

Gabriele Marrone

Il giorno 03/nov/06, alle ore 10:11, Dirk L=FCsebrink ha scritto:
while i easily get a webdav server up an running with

gem install webrick-webdav

and

require 'webrick'
require 'webrick/httpservlet/webdavhandler'

server =3D WEBrick::HTTPServer.new(context.values)
server.mount("/webdav", WEBrick::HTTPServlet::WebDAVHandler, =20
Dir.pwd)
...

and can mount and read the files, i still can't actually modify any of
the exported/mounted webdav files.

before i start diving into real problem tracking i would like to =20
ask if
someone of you had the same problems? i export/mount on mac os x. =20
might
this be a mac or a webrick-webdav problem? any tips welcomed,

have fun
dirk

Exactly, that's a Mac OS X issue: webrick-webdav supports protocol =20
version 1.0, while Mac OS X wants the server to support v2.0 in order =20=

to let you write on that share.
I had the same problem as yours, but I couldn't find enough =20
documentation anywhere (about webrick-webdav or about the version =20
required by OS X) so I started reading webrick-webdav sources and =20
comparing the traffic dump with an apache webdav module and I found =20
out this version issue.
Actually I think that the only difference between 1.0 and 2.0 servers =20=

is that the latter ones support LOCK methods, which allow to lock =20
files (exclusive or shared locks). I didn't need this, so I just =20
inherited from WebDAVHandler:

module WEBrick
module HTTPServlet
class WebDAVHandlerVersion2 < WebDAVHandler
def do_OPTIONS(req, res)
super
res["DAV"] =3D "1,2"
end
end
end
end

So I started using WebDAVHandlerVersion2 instead of WebDAVHandler. In =20=

fact, on the source code of WebDAVHandler there is a commented out =20
'res["DAV"] =3D "1,2"' line...
It worked, I'm quite sure I could write to that share, but right now =20
it seems like it doesn't work very well with OS X: I get strange =20
errors when writing into a file or creating a new one.
Some time ago I wrote a page about my experiments with WebDAV, since =20
I couldn't find enough documentation: http://gmarrone.objectblues.net/=20=

cgi-bin/wiki/WebDAV_-_Linux_server%2c_Mac_OS_X_client .
I summed up almost everything in this mail, but maybe you can find =20
something useful over there :)
It isn't up to date, though: I don't describe the errors I get now =20
with that solution.

Please let me know if your Mac OS X is able to write without any =20
error on that modified version of webrick-webdav :)
 
D

Dirk Lüsebrink

Gabriele said:
Il giorno 03/nov/06, alle ore 10:11, Dirk Luesebrink ha scritto:
...
I had the same problem as yours, but I couldn't find enough
documentation anywhere (about webrick-webdav or about the version
required by OS X) so I started reading webrick-webdav sources and
comparing the traffic dump with an apache webdav module and I found
out this version issue.

yes, i've also found the res["DAV"] = "1,2" but uncommenting it did not
work for me at first. but than i found the HTTPS stuff on your
page(http://gmarrone.objectblues.net/cgi-bin/wiki/WebDAV_-_Linux_server,_Mac_OS_X_client)
and i could get it to work. The strange errors you got, i had also,
"(Error code, -50)". I guess this is because of the missing UN/LOCK
implementation and so i tried putting an empty LOCK method in there:

class WebDAVHandlerVersion2
def do_LOCK req, res
puts "LOCK request: #{req}"
end
end

and this got me rid of the the 'strange' errors.

But now, what does it mean? What is UN/LOCK actually supposed to do?
(UNLOCK does not seem to be called at all?) Yeah, i could start looking
it up in the RFC, but i'm sick an tired of the Webdav promise. All could
have been so nice, when apple/microsoft/apache/etc would just have had
implemented what is written in the RFCs an i would not need to bother,
sigh. So, now i have a kind of working(kind of) webdav-webrick/version
2/read&write version server. lets see what happens next when putting it
into production use, hehe

thanx
dirk
 
G

Gabriele Marrone

Il giorno 07/nov/06, alle ore 23:07, Dirk L=FCsebrink ha scritto:
yes, i've also found the res["DAV"] =3D "1,2" but uncommenting it did =20=
not
work for me at first. but than i found the HTTPS stuff on your
page(http://gmarrone.objectblues.net/cgi-bin/wiki/WebDAV_-=20
_Linux_server%2c_Mac_OS_X_client)
and i could get it to work. The strange errors you got, i had also,
"(Error code, -50)". I guess this is because of the missing UN/LOCK
implementation and so i tried putting an empty LOCK method in there:

class WebDAVHandlerVersion2
def do_LOCK req, res
puts "LOCK request: #{req}"
end
end

and this got me rid of the the 'strange' errors.

Great work! :)
I didn't think about it.
But now, what does it mean? What is UN/LOCK actually supposed to do?
(UNLOCK does not seem to be called at all?) Yeah, i could start =20
looking
it up in the RFC, but i'm sick an tired of the Webdav promise. All =20
could
have been so nice, when apple/microsoft/apache/etc would just have had
implemented what is written in the RFCs an i would not need to bother,
sigh. So, now i have a kind of working(kind of) webdav-webrick/version
2/read&write version server. lets see what happens next when =20
putting it
into production use, hehe

I've just given a small peek at the RFC, looks like LOCK must return =20
a unique "lock token", which should be a URI, associated to that lock.
I guess your empty implementation confuses Mac OS X a little bit, =20
which thinks the lock has succeded but isn't going to UNLOCK since it =20=

doesn't know the lock token.

Well, I guess that's fine for a single user webdav share :)
 
D

Dirk Lüsebrink

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top