webrick-webdav gem: error in number of arguments to get_handler

Discussion in 'Ruby' started by Matt Falkenhagen, Jun 4, 2009.

  1. I am getting an error when I try to use a fresh install of the webrick-
    webdav gem on ruby 1.8.7.

    Specifically, if I run the following script to start a WEBrick server
    and then send a request for any file (not directory), an
    "ArgumentError: wrong number of arguments (2 for 1)" occurs.

    $ cat webdav_startup.rb
    #!/usr/bin/env ruby
    # Adapted from http://gmarrone.objectblues.net/cgi-bin/wiki/WebDAV_-
    # _Linux_server%2c_Mac_OS_X_client

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

    log = WEBrick::Log.new
    log.level = WEBrick::Log::DEBUG if $DEBUG
    serv = WEBrick::HTTPServer.new({
    :port => 8079,
    :FancyIndexing => true,
    :Logger => log
    })
    serv.mount("/", WEBrick::HTTPServlet::WebDAVHandler, Dir.pwd,
    {:FancyIndexing => true})
    trap:)INT){ serv.shutdown }
    serv.start
    $ ./webdav_startup.rb
    [2009-06-04 20:43:40] INFO WEBrick 1.3.1
    [2009-06-04 20:43:40] INFO ruby 1.8.7 (2008-08-11) [i486-linux]
    [2009-06-04 20:43:40] INFO WEBrick::HTTPServer#start: pid=18264
    port=8079
    [2009-06-04 20:44:06] ERROR ArgumentError: wrong number of arguments
    (2 for 1)
    /usr/lib/ruby/1.8/webrick/httpservlet/filehandler.rb:233:in
    `get_handler'
    /usr/lib/ruby/1.8/webrick/httpservlet/filehandler.rb:233:in
    `exec_handler'
    /usr/lib/ruby/1.8/webrick/httpservlet/filehandler.rb:171:in `do_GET'
    [...]
    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
    ./webdav_startup.rb:16
    server - - [04/Jun/2009:20:44:06 JST] "GET /.vimrc HTTP/1.1" 500 336
    - -> /.vimrc
    server - - [04/Jun/2009:20:44:09 JST] "GET / HTTP/1.1" 200 4741
    - -> /


    In webrick-webdav.rb, changing
    def get_handler(req)
    to
    def get_handler(req, res)

    seems to make everything work fine.

    What puzzles me is how this could have been possible. I suspect my
    WEBrick version (and hence ruby version) and webrick-webdav gem
    version are out of sync, as they disagree on the number of arguments
    for get_handler, but at one time they did since people have used this
    gem before. But you would then think that WEBrick at some point
    changed the number of arguments to get_handler... yet some quick
    searching yields no clues.

    Any ideas what happened here? It would be nice to get the gem to work
    out of the box or at least to document which versions of ruby it can
    be expected to work for.

    Thanks,
    Matt
     
    Matt Falkenhagen, Jun 4, 2009
    #1
    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. Lloyd Zusman
    Replies:
    2
    Views:
    415
  2. DeZo

    webrick-webdav

    DeZo, Apr 6, 2006, in forum: Ruby
    Replies:
    6
    Views:
    138
  3. DeZo
    Replies:
    0
    Views:
    117
  4. Dirk Lüsebrink
    Replies:
    4
    Views:
    191
    Dirk Lüsebrink
    Jan 1, 2007
  5. Michael Dichtl

    WebDAV: Connect Ruby to a WebDAV Server

    Michael Dichtl, Jul 9, 2007, in forum: Ruby
    Replies:
    7
    Views:
    959
    Rob Biedenharn
    Jul 9, 2007
Loading...

Share This Page