Skip to content
EntityQ1737219· pop 6· linked from 92 articles

HTTP library and web server

Source code

What makes Mongrel so fast is the careful use of an Ragel extension to provide fast, accurate HTTP 1.1 protocol parsing. This makes the server scream without too many portability issues. All of which should be done from your application's directory. It writes the PID of the process you ran into log/mongrel.pid. There are also many more new options for configuring the rails runner including changing to a different directory, adding more MIME types, and setting processor threads and timeouts. It doesn't explicitly require Camping, but if you want to run the examples/camping/ examples then you'll need to install Camping 1.2 at least (and redcloth I think). These are all available from RubyGems. class SimpleHandler < Mongrel::HttpHandler def process(request, response) response.start(200) do head,out head["Content-Type"] = "text/plain" out.write("hello! n") end end end If you run this and access port 3000 with a browser it will say "hello!". If you access it with any url other than "/test" it will give a simple 404. Check out the Mongrel::Error404Handler for a basic way to give a more complex 404 message. This also shows the DirHandler with directory listings. This is still rough but it should work for basic hosting. File extension to mime type mapping is missing though. E-mail the Mongrel list at and someone will help you. Comments about the API are welcome.

Excerpt from the source-code README · 3,088 chars · not written by Vinony

Wikidata facts

Official website
mongrel.rubyforge.org
Show 2 more facts
software version identifier
1.0.1
source code repository URL
github.com/mongrel/mongrel
Sources (4)

via Wikidata · CC0

Available in 6 languages

via Wikidata sitelinks · CC0

Connections

Categories