Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > webrick-webdav gem: error in number of arguments to get_handler

Thread Tools

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

Matt Falkenhagen
Posts: n/a
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
# _Linux_server%2c_Mac_OS_X_client

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

log =
log.level = WEBrick::Log:EBUG if $DEBUG
serv ={
ort => 8079,
:FancyIndexing => true,
:Logger => log
serv.mount("/", WEBrick::HTTPServlet::WebDAVHandler, Dir.pwd,
{:FancyIndexing => true})
trap(:INT){ serv.shutdown }
$ ./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
[2009-06-04 20:44:06] ERROR ArgumentError: wrong number of arguments
(2 for 1)
/usr/lib/ruby/1.8/webrick/httpservlet/filehandler.rb:171:in `do_GET'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
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)
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.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
python error PLS-00306: wrong number or types of arguments in Adeoluwa Odein Python 15 07-13-2011 09:28 PM
Call again a variadic function (... variable number of arguments)with same arguments that its variadic wrapper C Programming 3 12-31-2008 07:13 AM
functions and arguments.length; passing unknown number of arguments oldyork90 Javascript 10 09-27-2008 03:05 AM
OT: Number Nine, Number Nine, Number Nine FrisbeeŽ MCSE 37 09-26-2005 04:06 PM
Difference between default arguments and keyword arguments Edward Diener Python 14 04-05-2004 11:26 PM