Re: [ANN] Mongrel 0.1.1 -- A Fast Ruby Web Server (It Works Now, Maybe)



Zed Shaw wrote:

I previously announce Mongrel 0.1.0, but since I released that late at night it of course had errors. This is just a small announcement for the fixed source:

http://www.zedshaw.com/downloads/mongrel-0.1.1.tar.bz2

Please grab this one and give it a try.

This is a fantasy come true. Works nicely on Linux. Sensational! An era has opened.


I got Camping working with `register', but it needs both SCRIPT_NAME and PATH_INFO filled properly to work right. In the case of a script mounted at /blog, a /blog/view request should end up as (following the traditional CGI ways):

 SCRIPT_NAME = /blog
 PATH_INFO = /view

Anyway, here's a crappy postamble for any Camping scripts out there (none):

if __FILE__ == $0
Camping::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'blog3.db'
Camping::Models::Base.logger = Logger.new('camping.log')
require 'mongrel'


   class CampingHandler < Mongrel::HttpHandler
       def process(request, response)
           Object.instance_eval do
               remove_const :ENV
               const_set :ENV, request
           end
           ENV['PATH_INFO'] = '/'
           s = response.socket
           def s.<<(str)
               write("HTTP/1.1 200 OK\r\n#{str}")
           end
           Camping.run('', response.socket)
       end
   end

   h = Mongrel::HttpServer.new("0.0.0.0", "3000")
   h.register("/blog", CampingHandler.new)
   h.run.join
 end

_why


.



Relevant Pages