![]() |
webrick-webdav gem: error in number of arguments to get_handler
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 |
| All times are GMT. The time now is 12:10 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.