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

Discussion in 'Ruby' started by Dirk Lüsebrink, Nov 3, 2006.

  1. 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


    --
    Posted via http://www.ruby-forum.com/.
    Dirk Lüsebrink, Nov 3, 2006
    #1
    1. Advertising

  2. 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 :)
    Gabriele Marrone, Nov 3, 2006
    #2
    1. Advertising

  3. Re: webrick-webdav(gem) served files are mounted only read-o

    Gabriele Marrone wrote:
    > Il giorno 03/nov/06, alle ore 10:11, Dirk Luesebrink ha scritto:
    >
    >> server.mount("/webdav", WEBrick::HTTPServlet::WebDAVHandler,
    >> this be a mac or a webrick-webdav problem? any tips welcomed,

    ...
    > 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




    --
    Posted via http://www.ruby-forum.com/.
    Dirk Lüsebrink, Nov 7, 2006
    #3
  4. Re: webrick-webdav(gem) served files are mounted only read-o

    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 :)

    >
    > thanx
    > dirk
    Gabriele Marrone, Nov 7, 2006
    #4
  5. Re: webrick-webdav(gem) served files are mounted only read-o

    Gabriele Marrone wrote:
    >
    > Well, I guess that's fine for a single user webdav share :)


    very well so! i took the time to pack the stuff and made it a gem so you
    can easily install it and serve your file directly from the the
    commandline.

    http://www.sofasportler.de/dirk.blo...er-ruby-gem-serve-files-from-the-commandline/

    many thanks for your help and who knows? maybe one day we might even
    sort out the DAV2 LOCK protocol issues. Until then,

    thank you and happy new year




    --
    Posted via http://www.ruby-forum.com/.
    Dirk Lüsebrink, Jan 1, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin Pirker

    overhead of WEBrick served http?

    Martin Pirker, Oct 11, 2004, in forum: Ruby
    Replies:
    3
    Views:
    112
    Martin Pirker
    Oct 12, 2004
  2. anne001
    Replies:
    1
    Views:
    162
    anne001
    Jun 20, 2006
  3. Michael Dichtl

    WebDAV: Connect Ruby to a WebDAV Server

    Michael Dichtl, Jul 9, 2007, in forum: Ruby
    Replies:
    7
    Views:
    851
    Rob Biedenharn
    Jul 9, 2007
  4. Matt Falkenhagen
    Replies:
    0
    Views:
    131
    Matt Falkenhagen
    Jun 4, 2009
  5. F. Senault
    Replies:
    0
    Views:
    132
    F. Senault
    Nov 18, 2010
Loading...

Share This Page