Forum: Ruby Bug in Webrick::CampingHandler (typo in the code)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Vassilis R. (Guest)
on 2007-07-05 19:51
(Received via mailing list)
OK, I can't seem to get ticket creation priviliges in the Trac for
Camping so I'll post it here for _why to see.

On the occasion of the LRSC Name Picker summary I adapted a bit of the
code to play around with X-Sendfile headers.

In my setup, instead of using CampingServer I use the WEBRick handler:
  s = HTTPServer.new(:Port => port, :DocumentRoot => docroot )
  s.mount mountpoint, WEBrick::CampingHandler, RutemaWeb

This view:
class StyleSheet < R '/style.css'
  def get
   @headers['Content-Type'] = 'text/css'
   @headers['X-Sendfile'] = File.join(RutemaWeb::HTDOCS,"style.css")
  end
end

generates the following exception in WEBRick:
localhost - - [05/Jul/2007:17:33:44 CEST] "GET / HTTP/1.1" 200 1223
- -> /
[2007-07-05 17:33:44] ERROR NameError: undefined local variable or
method `res' for #<WEBrick::CampingHandler:0x262a1f4>

/opt/local/lib/ruby/gems/1.8/gems/camping-1.5/lib/camping/webrick.rb:59:in
`service'
         /opt/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
         /opt/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
         /opt/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
         /opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
         /opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
         /opt/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
         /opt/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
         /opt/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
         /opt/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
         /opt/local/lib/ruby/1.8/webrick/server.rb:82:in `start'
         ./lib/rutemaweb/rutemaweb.rb:247:in `start_server'
         bin/rutemaweb:9
localhost - - [05/Jul/2007:17:33:44 CEST] "GET /style.css HTTP/1.1" 500
367
http://localhost:3301/ -> /style.css

The problem is line 59 in camping/webrick.rb:

-do_GET(req, res)
+do_GET(req, resp)

I've got the camping 1.5 gem installed.
Cheers,
V.-
Gregory B. (Guest)
on 2007-07-05 20:00
(Received via mailing list)
On 7/5/07, Vassilis R. <removed_email_address@domain.invalid> wrote:
> OK, I can't seem to get ticket creation priviliges in the Trac for
> Camping so I'll post it here for _why to see.

I filed a ticket on your behalf:
http://code.whytheluckystiff.net/camping/ticket/134

To get access to the Trac, you should enter your rubyforge info here:
http://code.whytheluckystiff.net/access/

I can't remember if it takes some time to process, but then you can
just log in with your RubyForge username and password.

cheers,
-greg
This topic is locked and can not be replied to.