From af7cebc8eb6c12b91bb047c89b321053a1f3685f Mon Sep 17 00:00:00 2001 From: zedshaw Date: Thu, 11 May 2006 19:10:34 +0000 Subject: [PATCH] Mongrel 0.3.13 release push. Lots of documentation started and little fixes. See news page for more details. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@165 19e92222-5c0b-0410-8929-a290d50e31e9 --- Rakefile | 12 ++- bin/mongrel_rails | 4 +- doc/site/src/default.template | 2 +- doc/site/src/docs/apache.page | 8 ++ doc/site/src/docs/camping.page | 8 ++ doc/site/src/docs/choosing_deployment.page | 7 ++ doc/site/src/docs/distributed_worker.page | 8 ++ doc/site/src/docs/index.page | 93 +++++++++++++++++++--- doc/site/src/docs/litespeed.page | 8 ++ doc/site/src/docs/mongrel_cluster.page | 9 +++ doc/site/src/docs/nitro.page | 8 ++ doc/site/src/docs/pen_balance.page | 8 ++ doc/site/src/docs/performance.page | 10 +++ doc/site/src/docs/pound.page | 8 ++ doc/site/src/docs/rails_to_handler.page | 10 +++ doc/site/src/docs/ruby_on_rails.page | 8 ++ doc/site/src/docs/security.page | 8 ++ doc/site/src/docs/upload_progress.page | 8 ++ doc/site/src/faq.page | 83 ++++++++++++++++++- doc/site/src/index.page | 78 +++++------------- doc/site/src/license.page | 73 +++++++++++++++++ doc/site/src/news.page | 29 +++++++ doc/site/src/plugins.page | 22 +++++ ext/http11/http11.c | 3 - lib/mongrel.rb | 15 +++- lib/mongrel/debug.rb | 7 +- 26 files changed, 452 insertions(+), 85 deletions(-) create mode 100644 doc/site/src/docs/apache.page create mode 100644 doc/site/src/docs/camping.page create mode 100644 doc/site/src/docs/choosing_deployment.page create mode 100644 doc/site/src/docs/distributed_worker.page create mode 100644 doc/site/src/docs/litespeed.page create mode 100644 doc/site/src/docs/mongrel_cluster.page create mode 100644 doc/site/src/docs/nitro.page create mode 100644 doc/site/src/docs/pen_balance.page create mode 100644 doc/site/src/docs/performance.page create mode 100644 doc/site/src/docs/pound.page create mode 100644 doc/site/src/docs/rails_to_handler.page create mode 100644 doc/site/src/docs/ruby_on_rails.page create mode 100644 doc/site/src/docs/security.page create mode 100644 doc/site/src/docs/upload_progress.page create mode 100644 doc/site/src/license.page create mode 100644 doc/site/src/plugins.page diff --git a/Rakefile b/Rakefile index 7d5cd484..ce8aecad 100644 --- a/Rakefile +++ b/Rakefile @@ -16,7 +16,15 @@ desc "Does a full compile, test run" task :default => [:compile, :test] desc "Compiles all extensions" -task :compile => [:http11] +task :compile => [:http11] do + if Dir.glob(File.join("lib","http11.*")).length == 0 + STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + STDERR.puts "Gem actually failed to build. Your system is" + STDERR.puts "NOT configured properly to build RubyGems." + STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + exit(1) + end +end task :package => [:clean,:compile,:test] task :ragel do @@ -32,7 +40,7 @@ end setup_extension("http11", "http11") name="mongrel" -version="0.3.12.5" +version="0.3.13" setup_gem(name, version) do |spec| spec.summary = "A small fast HTTP library and server that runs Rails, Camping, and Nitro apps." diff --git a/bin/mongrel_rails b/bin/mongrel_rails index 6f2635bb..82b0a45c 100644 --- a/bin/mongrel_rails +++ b/bin/mongrel_rails @@ -17,8 +17,8 @@ class Start < GemPlugin::Plugin "/commands" ['-a', '--address ADDR', "Address to bind to", :@address, "0.0.0.0"], ['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"], ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "log/mongrel.pid"], - ['-n', '--num-procs INT', "Number of processor threads to use", :@num_procs, 1024], - ['-t', '--timeout SECONDS', "Timeout all requests after SECONDS time", :@timeout, 0], + ['-n', '--num-procs INT', "Number of processors active before clients denied", :@num_procs, 1024], + ['-t', '--timeout TIME', "Timeout all requests after 100th seconds time", :@timeout, 0], ['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil], ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, Dir.pwd], ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, "public"], diff --git a/doc/site/src/default.template b/doc/site/src/default.template index eb3fd451..c5e79865 100644 --- a/doc/site/src/default.template +++ b/doc/site/src/default.template @@ -47,7 +47,7 @@
-
Mar-10-2006
+
Apr-10-2006
Mongrel 0.3.12.4 -- Relaxed Parser, Date Fix
diff --git a/doc/site/src/docs/apache.page b/doc/site/src/docs/apache.page new file mode 100644 index 00000000..3c24700f --- /dev/null +++ b/doc/site/src/docs/apache.page @@ -0,0 +1,8 @@ +--- +title: Apache +inMenu: true +directoryName: Apache +--- + +h1. Apache Best Practice Deployment + diff --git a/doc/site/src/docs/camping.page b/doc/site/src/docs/camping.page new file mode 100644 index 00000000..8ba975e0 --- /dev/null +++ b/doc/site/src/docs/camping.page @@ -0,0 +1,8 @@ +--- +title: Camping Issues +inMenu: true +directoryName: Camping Issues +--- + +h1. Camping Issues + diff --git a/doc/site/src/docs/choosing_deployment.page b/doc/site/src/docs/choosing_deployment.page new file mode 100644 index 00000000..f91f71db --- /dev/null +++ b/doc/site/src/docs/choosing_deployment.page @@ -0,0 +1,7 @@ +--- +title: Choosing Deployment +inMenu: true +directoryName: Choosing Deployment +--- + +h1. Choosing The Best Deployment diff --git a/doc/site/src/docs/distributed_worker.page b/doc/site/src/docs/distributed_worker.page new file mode 100644 index 00000000..0efb003f --- /dev/null +++ b/doc/site/src/docs/distributed_worker.page @@ -0,0 +1,8 @@ +--- +title: Distributed Worker +inMenu: true +directoryName: Distributed Worker +--- + +h1. Using Distributed Worker For Long Tasks + diff --git a/doc/site/src/docs/index.page b/doc/site/src/docs/index.page index 41b25422..5bcd7d31 100644 --- a/doc/site/src/docs/index.page +++ b/doc/site/src/docs/index.page @@ -10,26 +10,101 @@ We've got a small set of documentation to get people going. Most of it is geared toward Ruby on Rails but other projects using Mongrel should have their own docs that you can refer to based on these. + +h2. Getting Started + +Start here to get a good grounding in getting Mongrel up and running. +These documents are targetted at developers who will be starting off +using Mongrel and might want to throw in a few little tricks. +Serious deployments should check out *Deployment Best Practices*. + * "Getting Started":started.html -- Installing and Other things -* "HOWTO":howto.html -- Doing advanced stuff with Mongrel. * "Win32 HOWTO":win32.html -- Specific instructions for running on windows. +* "HOWTO":howto.html -- Doing advanced stuff with Mongrel. +* "Using mongrel_cluster":mongrel_cluster.html -- Nifty plugin for managing your clusters. +* "Choosing A Deployment":choosing_deployment.html -- How to pick a best practice. +* "Security":security.html -- Security issues to look at (for any web application). + + +h2. Frameworks + +Specific problems and things to know when you run different +frameworks. + +* "Ruby on Rails Issues":ruby_on_rails.html +* "Camping Issues":camping.html +* "Nitro Issues":nitro.html + + +h2. Deployment Best Practices + +These documents are continually changing as deploying Mongrel +becomes more solid and certain options and configurations +start to work the best. Each one is a *best practice* which +means that if you do something different then you'll have to +do your own research. Best way to work it is to do the +*best practice* exactly as described, then try to do something +weird from there. + +* "Apache":apache.html -- Currently the best way to deploy Mongrel. +* "Litespeed":litespeed.html -- Another good option, but not open source. * "Lighttpd":lighttpd.html -- Using mod_proxy to do a cluster. +* "Pound":pound.html -- Small scale and dead simple with SSL. +* "Pen or Balance":pen_balance.html -- Smaller scale without SSL. + + +h2. Advanced + +You are a grand master and have answered a few questions on the +Mongrel mailing list so now it's time to get fancy. + * "Writing Mongrel Plugins":gem_plugin.html -- Writing a GemPlugin for Mongrel. +* "From Rails To Handlers":rails_to_handler.html -- Writing a Handler plugin for something that's slow in Rails. +* "Distributed Worker":distributed_worker.html -- A common pattern for actions that take forever and block Rails. +* "Upload Progress Without Rails":upload_progress.html -- Uploading without blocking Rails and giving the user progress. +* "Performance Tuning":performance.html -- Measuring, tuning, tweaking (in that order). + + + +h2. Ruby API Documentation + +People writing plugins will want these. + +* "Mongrel RDoc":/rdoc/index.html +* "GemPlugin RDoc":/gem_plugin_rdoc/index.html + If there's documentation you'd like then feel free to e-mail the list or post to the tracker. -h2. RDoc API Documentation +h1. Other People's Documentation -Check out the "RDoc":/rdoc/index.html documentation to get a look at the -API and dig into the source. Since Mongrel is currently being used by -other frameworks it's documentation is aimed at developers. Real manuals -will be written when there's something for "regular" folks to use. +Many other folks have written documentation that they post to their +blogs for people to use. I've based a lot of the documentation +here on their writings, so you should go check out their blogs +and shoot them a thanks when you can. + +* "What About Apache to Mongrel for Rails Applications":http://weblog.textdrive.com/article/219/what-about-apache-to-mongrel-for-rails-applications +* "Apache 2.2 worker on solaris to a remote mongrel":http://weblog.textdrive.com/article/223/apache-22-worker-on-solaris-to-a-remote-mongrel +* "Apache 2.2, mod_proxy_balancer and Mongrel":http://weblog.textdrive.com/article/224/apache-22-mod_proxy_balancer-and-mongrel +* "Scaling Rails with Apache 2.2, mod_proxy_balancer and Mongrel":http://blog.innerewut.de/articles/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel +* "Dead Simple Deployment":http://brainspl.at/articles/2006/04/26/dead-simple-deployment -h2. Frequently Asked Questions +h1. Frequently Asked Questions When people ask questions really frequently the results end up in the -"FAQ":faq.html or if they're funny they end up in the "FASQ":../fasq.html -so everyone can have a laugh. +"FAQ":faq.html. + + +h1. Mailing Lists + +There's a "mailing list":http://rubyforge.org/mailman/listinfo/mongrel-users that +you should subscribe to if you're looking for help or are interested in tracking +Mongrel. We post announcements of pre-release gems you can play with to this +mailing list and also discuss development of Mongrel there. + +Before you start asking for features you should read about +"bikeshedding":http://www.catb.org/jargon/html/B/bikeshedding.html and +understand that we're really nice, but sometimes code speaks better than rhetoric. diff --git a/doc/site/src/docs/litespeed.page b/doc/site/src/docs/litespeed.page new file mode 100644 index 00000000..de4d96ed --- /dev/null +++ b/doc/site/src/docs/litespeed.page @@ -0,0 +1,8 @@ +--- +title: Litespeed +inMenu: true +directoryName: Litespeed +--- + +h1. Litspeed Best Practice Deployment + diff --git a/doc/site/src/docs/mongrel_cluster.page b/doc/site/src/docs/mongrel_cluster.page new file mode 100644 index 00000000..544d88f2 --- /dev/null +++ b/doc/site/src/docs/mongrel_cluster.page @@ -0,0 +1,9 @@ +--- +title: mongrel_cluster +inMenu: true +directoryName: mongrel_cluster +--- + +h1. Using Mongrel Cluster + + diff --git a/doc/site/src/docs/nitro.page b/doc/site/src/docs/nitro.page new file mode 100644 index 00000000..f6ba5295 --- /dev/null +++ b/doc/site/src/docs/nitro.page @@ -0,0 +1,8 @@ +--- +title: Nitro +inMenu: true +directoryName: Nitro +--- + +h1. Nitro Issues + diff --git a/doc/site/src/docs/pen_balance.page b/doc/site/src/docs/pen_balance.page new file mode 100644 index 00000000..be6162e7 --- /dev/null +++ b/doc/site/src/docs/pen_balance.page @@ -0,0 +1,8 @@ +--- +title: Pen/Balance +inMenu: true +directoryName: Pen/Balance +--- + +h1. Pen/Balance Best Practice Deployment + diff --git a/doc/site/src/docs/performance.page b/doc/site/src/docs/performance.page new file mode 100644 index 00000000..cf2ffbf7 --- /dev/null +++ b/doc/site/src/docs/performance.page @@ -0,0 +1,10 @@ +--- +title: Performance Tuning +inMenu: true +directoryName: Performance Tuning +--- + +h1. Performance Measurement, Tuning, Tweaking (in that order) + + + diff --git a/doc/site/src/docs/pound.page b/doc/site/src/docs/pound.page new file mode 100644 index 00000000..4436aa01 --- /dev/null +++ b/doc/site/src/docs/pound.page @@ -0,0 +1,8 @@ +--- +title: Pound +inMenu: true +directoryName: Pound +--- + +h1. Pound Best Practice Deployment + diff --git a/doc/site/src/docs/rails_to_handler.page b/doc/site/src/docs/rails_to_handler.page new file mode 100644 index 00000000..fa4f893b --- /dev/null +++ b/doc/site/src/docs/rails_to_handler.page @@ -0,0 +1,10 @@ +--- +title: Rails To Handlers +inMenu: true +directoryName: Rails To Handlers +--- + +h1. Writing Handlers to Speed Rails + + + diff --git a/doc/site/src/docs/ruby_on_rails.page b/doc/site/src/docs/ruby_on_rails.page new file mode 100644 index 00000000..ef60a3dc --- /dev/null +++ b/doc/site/src/docs/ruby_on_rails.page @@ -0,0 +1,8 @@ +--- +title: Rails Issues +inMenu: true +directoryName: Rails Issues +--- + +h1. Ruby On Rails Issues + diff --git a/doc/site/src/docs/security.page b/doc/site/src/docs/security.page new file mode 100644 index 00000000..6ec39d3b --- /dev/null +++ b/doc/site/src/docs/security.page @@ -0,0 +1,8 @@ +--- +title: Security +inMenu: true +directoryName: Security +--- + +h1. Web Application Security Issues + diff --git a/doc/site/src/docs/upload_progress.page b/doc/site/src/docs/upload_progress.page new file mode 100644 index 00000000..bc171fe2 --- /dev/null +++ b/doc/site/src/docs/upload_progress.page @@ -0,0 +1,8 @@ +--- +title: Upload Progress +inMenu: true +directoryName: Upload Progress +--- + +h1. Mongrel Upload Progress Plugin + diff --git a/doc/site/src/faq.page b/doc/site/src/faq.page index a21035f4..1beffbad 100644 --- a/doc/site/src/faq.page +++ b/doc/site/src/faq.page @@ -37,8 +37,8 @@ your Mongrel server straight to the network. h3. Q: How is Mongrel designed? The design of Mongrel most closely matches "Simple":http://simpleweb.sourceforge.net/ -which is very nicely designed web server framework for Java. Despite being written -in Java it is very clean and simple, thus the name (clever eh?). The main difference +which is a very nicely designed web server framework for Java. Despite being written +in Java Simple is very clean and simple, thus the name (clever eh?). The main difference between Mongrel and Simple is that Simple monitors returned output from handlers so that it can modify the results. Mongrel instead uses Ruby's blocks to get the same effect. @@ -98,6 +98,81 @@ h2. Deployment h3. Q: How do I deploy Mongrel in production? -Take a look at the "HOWTO":docs/howto.html and the "Lighttpd":docs/lighttpd.html -instructions for more information on this. +Take a look at the "documentation pages":/docs/index.html for +information on deploying and enhancing Mongrel. Feel free to +suggest documentation that you think is needed. + + +h3. Q: What does num-procs do? + +There's two options that impact how your deployment performs +and what kind of resources it eats. + +* num-procs -- Determines how many active requests are allowed +before clients are denied and old requests are killed off. +* timeout -- Determines a short sleep time between each client +that is accepted. This acts as a kind of throttle. + +With num-procs you should think of it as the option that protects +your server from overload. Let's say you set it to 100 and you +get 100 requests coming in that are all being worked on. If +request 101 comes in then that request gets closed immediately, +and Mongrel goes through the original 100 looking for requests to +kill off. Right now it uses the timeout to come up with a reasonable +way to determine how long something is taking and will kill old +processors with an exception. + +The timeout option is what you use if you want to make sure that +a Mongrel server can't take on too much work (i.e. you need to +throttle it). What it does is sleep for N 100th/second after +each accept. This means that it will slow down the number of +incoming clients. Very handy if you have a shared hosting system +and don't want people to eat your servers. + + +h3. Q: Mongrel stops working if it's left alone for a long time. + +If you find that Mongrel stops working after a long idle time +and you're using MySQL then you're hitting a bug in the MySQL +driver that doesn't properly timeout connections. What happens +is the MySQL *server* side of the connection times out and closes, +but the MySQL *client* doesn't detect this and just sits there. + +What you have to do is set: + + ActiveRecord::Base.verification_timeout = 14400 + +Or to any value that is lower than the MySQL server's *interactive_timeout* +setting. This will make sure that ActiveRecord checks the connection +often enough to reset the connection. + + +h3. Q: Why is the first request to Mongrel really slow? + +The first request to *any* system will be slower than +the others, you are just noticing it with Mongrel because +the difference is so much larger. + +The cause of this depends on many factors, but typically it +is either Rails start-up, slow machine, no memory, or eager loading +the world. If you are on a slow box, or if you are trying to +load a huge amount of data when Rails starts, then the +first request will be nasty slow. + +This shouldn't really bug you though unless it happens periodically +rather than from a cold start. If it happens from a cold start or +after a long idle period then point your service monitor at your +application to keep it fresh. + +If you run a long performance test and you see periodic pauses +then you may have a memory leak or not enough ram. Re-run your +test while you monitor your ram with something like *top*. If +you see the ram of Mongrel increase and then drop, or just increase, +or you see the swap grow and shrink, then you've got a memory leak +or just simply need more ram. + +Debugging a leak is possible with the mongrel_rails start -B option. +It will log objects that get created to log/mongrel_debug and you can +look in there to find out what object is causing the problems. + diff --git a/doc/site/src/index.page b/doc/site/src/index.page index a4b03484..eaef5979 100644 --- a/doc/site/src/index.page +++ b/doc/site/src/index.page @@ -8,7 +8,7 @@ h1. What is Mongrel? Mongrel is a fast HTTP library and server for Ruby that is intended for hosting Ruby web applications of any kind using plain HTTP rather than FastCGI or SCGI. It is framework agnostic and already supports -"Ruby On Rails":http://www.rubyonrails.org, "Og+Nitro":http://www.nitrohq.com/, +"Ruby On Rails":http://www.rubyonrails.org, "Og+Nitro":http://www.nitroproject.org/, and "Camping":http://camping.rubyforge.org/files/README.html frameworks. @@ -28,72 +28,32 @@ Which runs Mongrel in the background. You can stop it with: And you're all set. There's quite a few options you can set for the start command. Use the *mongrel_rails start -h* to see them all. +h2. Win32 Support -h3. Win32 Support +Wind32 is fully supported by Mongrel with services and CPU +affinity support. You should ready the "Win32 HOWTO":docs/win32.html +for information on getting started. -Mongrel now has support for running as a Win32 service right out of the -box. The support is still rough but works well enough that we decided -to release it. You can thank Luis Lavena for working on this and making -it so nice. - -After you do the gem install, find a Rails application you want to run -and do: - - $ mongrel_rails_service install -n myapp \ - -r c:\my\path\to\myapp -p 4000 -e production - $ mongrel_rails_service start -n myapp - -Now hit the port and poof, works. Stopping the app is just done with: - - $ mongrel_rails_service stop -n myapp - -And, you can *even* set the CPU processor affinity for the service when -yourun the install command. Can't even do that on POSIX yet. Now -that's hot. - -If you run into an app that's not running right, my suggestion is to run it with -the regular mongrel_rails runner: - - $ cd c:\my\path\to\myapp - $ mongrel_rails start -p 4500 - -Since that will spit out error messages and stuff to the console. *Use CTRL-Pause/Break to stop.* +The main thing with Win32 support is that there is no *fork* +API for Ruby, so you have to use the services features to +get persistent servers running. -h2. Performance +h1. Next Steps -Mongrel's main competitor is WEBrick and "Tomcat":http://tomcat.apache.org/ but not -a full webserver like "Apache":http://httpd.apache.org/ or "lighttpd":http://www.lighttpd.net/ -for serving static content. Mongrel is designed to run a web application with minimal -static content capabilities with the idea that you'll put it behind a webserver that's -faster for the static stuff. +Now that you're a Mongrel user, there's some thing you should +do to educate yourself: -So far Mongrel seems competitive with Tomcat and typically blows the doors off WEBrick. -Comparing Mongrel with Tomcat right now is not too fair since Tomcat does a whole lot -more, but for serving basic content mongrel does pretty good. +* "Join the mailing list":http://rubyforge.org/mailman/listinfo/mongrel-users +* "Read the documentation":docs/index.html +* Learn to use --help when you want to know what Mongrel commands can do. -There will be a more formal performance analysis when Mongrel is more stable. - -*NOTE: On FreeBSD and Mac OSX I've found Mongrel performs really poorly.* Compared -to Linux, Win32, or NetBSD these two OS seem to be doing something very "different". -We'll be tuning these two platforms better, but it may just be a Ruby problem. +The last one is important. A lot of effort went into making +Mongrel as self-documenting as possible. Before you hit the +mailing list asking how to do something, try passing that +command --help and see if it tells you. If it's still not +clear then ask away. -h2. Documentation - -Check out the "RDoc":/rdoc/index.html documentation to get a look at the -API and dig into the source. Since Mongrel is currently being used by -other frameworks it's documentation is aimed at developers. Real manuals -will be written when there's something for "regular" folks to use. -h2. Mailing Lists - -There's a "mailing list":http://rubyforge.org/mailman/listinfo/mongrel-users that -you should subscribe to if you're looking for help or are interested in tracking -Mongrel. We post announcements of pre-release gems you can play with to this -mailing list and also discuss development of Mongrel there. - -Before you start asking for features you should read about -"bikeshedding":http://www.catb.org/jargon/html/B/bikeshedding.html and -understand that we're really nice, but sometimes code speaks better than rhetoric. \ No newline at end of file diff --git a/doc/site/src/license.page b/doc/site/src/license.page new file mode 100644 index 00000000..8e187827 --- /dev/null +++ b/doc/site/src/license.page @@ -0,0 +1,73 @@ +--- +title: Licensing +inMenu: true +directoryName: Licensing +--- + +h1. Mongrel Licensing + +Mongrel is licensed under the "LGPL":http://www.gnu.org/licenses/lgpl.html and is copyright Zed A. Shaw +as of 2005. If you use Mongrel and are worried about the +licensing status, then you should talk with your legal team +and follow their advice. If you use Mongrel and +are concerned about how that impacts your software, then contact +me about a commercial license or how you can donate to a charity to get a commercial license. + +I don't use "LGPL":http://www.gnu.org/licenses/lgpl.html to force people to also "LGPL":http://www.gnu.org/licenses/lgpl.html license their software, +but rather to make sure that people who modify *Mongrel* give back to +the community. The general rule is that if you treat the +Mongrel RubyGem directory like it's a got an evil firewall +around it then you're good. You can link to it, run your +applications under it, and even write GemPlugins to change +Mongrel without touching the source. + +If you dip into the Mongrel RubyGem directory and change +even one line of source, or copy a portion of the source +into your project, then you have to do the following: + +* E-mail me what you changed and find out if I would include it in Mongrel. Usually I will. +* If I can't or won't include it, then consider taking it out and writing a GemPlugin. +* If you have to have this change in Mongrel and I can't take the patch (since it's specific to your application), + *and* you can't make a GemPlugin, then you'll have to either: +** License your software under the "LGPL":http://www.gnu.org/licenses/lgpl.html and release it. +** Include the changed files in your release and allow the customer to access them, giving proper attribution. +** Contact me for a commercial license. +** Contact me about donating to a charity in exchange for a commercial license. + +I'm not interested in hunting people down who use Mongrel in +commercial products nor am I a GPL zealot. I understand that +folks just want to run their software under Mongrel and might +need to make a few changes. As long as you share those changes +when you make them then I'll be happy and you'll be safe. + + +h2. Non-profit Organizations + +If you're a registered non-profit organization that is using +Mongrel then you don't have to worry about any of the above. +You are free to use Mongrel however you want and I'll even +be willing to help you out in exchange for tax credit or +just to be a good guy. + +I'd appreciate your changes or stories about how you're using +it, but otherwise feel free to use Mongrel however you want. + + +h2. GemPlugins + +The GemPlugins system is both freely available *and* +licensed under the Ruby License. Feel free to use it just +like you would Ruby and work it into your projects as you +need. This is done so people can write their own GemPlugins +for Mongrel without having to re-license them under the +"LGPL":http://www.gnu.org/licenses/lgpl.html. + + +h2. Some Charities To Consider + +Any charity that helps children is a good one. My personal +favorite is "The Train Platform Schools":http://www.globalfundforchildren.org/project_profiles/train_schools.htm +in India. They help children who are extremely poor get food, +medical attention, and education by holding small school sessions +on the train platforms in Bhubaneswar, India. + diff --git a/doc/site/src/news.page b/doc/site/src/news.page index fa25387d..06c5c8c6 100644 --- a/doc/site/src/news.page +++ b/doc/site/src/news.page @@ -7,6 +7,35 @@ ordering: 2 h1. Latest News +h2. May 11: Mongrel 0.3.13 Pre-Release -- Out of Hibernation + +This release is the long awaited 0.3.13 with the fancy +file upload and conditional response code. It's also +the start to the big push toward 0.4 Mongrel Enterprisey Edition 1.2. + +The big fixes and features in 0.3.13 are: + +* Lots of documentation being written or already written. +* Large file uploads are streamed to a temp file rather than ram. (Thanks Why!) +* Conditional HTTP responses for static files. (Thanks Dan Kubb!) +* A fix to the start command's --help so that --num-procs and --timeout are more clear. +* A fix to the -B option since some idiot decided that they can change the object_id of an object to take a parameter. +* No longer spews tons of junk to mongrel.log related to invalid parsing or closed client sockets. +* Documented HttpRequest's escape, unescape, and query_parse (which were stolen from Camping). +* Removed some compiler warnings for unused variables in the C extension. +* Rake now aborts with an obvious message if the http11 extension doesn't build. +* Requires 'resolv-replace' by default to prevent DNS queries from blocking Mongrel. + +This release is right now in pre-release state while I work on the +documentation. Please grab it and test it with the following: + + gem install daemons + gem install --source=http://mongrel.rubyforge.org/releases/ + +As usual, win32 folks will have to wait while I test out this build +on Windows. + + h2. Apr-10: Mongrel 0.3.12.4 -- Relaxed Parser, Date Fix This release is a small change over the previous one. It mostly is for diff --git a/doc/site/src/plugins.page b/doc/site/src/plugins.page new file mode 100644 index 00000000..5f5b22f9 --- /dev/null +++ b/doc/site/src/plugins.page @@ -0,0 +1,22 @@ +--- +title: Plugins +inMenu: true +directoryName: Plugins +--- + +h1. Available Mongrel Plugins + +Mongrel is designed to be *very* easy to extend with the +"GemPlugin":/gem_plugin_rdoc/index.html system. With +GemPlugin anyone can extend Mongrel's commands or handlers +then distribute them as regular RubyGems for people to install. + +* mongrel_cluster -- Very sweet plugin that lets you manage a + pack of Mongrels easily as well as dealing with Capistrano issues. + + +h2. Licensing + +People interested in extending Mongrel and avoiding licensing +problems (Mongrel is LGPL) can use GemPlugins without any +problems since the GemPlugin system is Ruby Licensed. diff --git a/ext/http11/http11.c b/ext/http11/http11.c index 00983eda..a70cf134 100644 --- a/ext/http11/http11.c +++ b/ext/http11/http11.c @@ -23,7 +23,6 @@ static VALUE global_content_type; static VALUE global_http_content_type; static VALUE global_gateway_interface; static VALUE global_gateway_interface_value; -static VALUE global_interface_value; static VALUE global_server_name; static VALUE global_server_port; static VALUE global_server_protocol; @@ -122,8 +121,6 @@ void header_done(void *data, const char *at, size_t length) { VALUE req = (VALUE)data; VALUE temp = Qnil; - VALUE host = Qnil; - VALUE port = Qnil; VALUE ctype = Qnil; VALUE clen = Qnil; char *colon = NULL; diff --git a/lib/mongrel.rb b/lib/mongrel.rb index 60932dfb..3105f9b5 100644 --- a/lib/mongrel.rb +++ b/lib/mongrel.rb @@ -10,7 +10,7 @@ require 'mongrel/tcphack' require 'yaml' require 'time' require 'rubygems' - +require 'resolv-replace' begin require 'sendfile' @@ -19,6 +19,7 @@ rescue Object # do nothing end + # Mongrel module containing all of the classes (include C extensions) for running # a Mongrel web server. It contains a minimalist HTTP server with just enough # functionality to service web application requests fast as possible. @@ -201,6 +202,9 @@ module Mongrel end end + # Performs URI escaping so that you can construct proper + # query strings faster. Use this rather than the cgi.rb + # version since it's faster. (Stolen from Camping). def self.escape(s) s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) { '%'+$1.unpack('H2'*$1.size).join('%').upcase @@ -208,13 +212,17 @@ module Mongrel end + # Unescapes a URI escaped string. (Stolen from Camping). def self.unescape(s) s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){ [$1.delete('%')].pack('H*') } end - + # Parses a query string by breaking it up at the '&' + # and ';' characters. You can also use this to parse + # cookies by changing the characters used in the second + # parameter (which defaults to '&;'. def self.query_parse(qs, d = '&;') params = {} (qs||'').split(/[#{d}] */n).inject(params) { |h,p| @@ -505,11 +513,10 @@ module Mongrel data << client.readpartial(Const::CHUNK_SIZE) end end - rescue EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL + rescue EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF # ignored rescue HttpParserError STDERR.puts "#{Time.now}: BAD CLIENT (#{params[Const::HTTP_X_FORWARDED_FOR] || client.peeraddr.last}): #$!" - STDERR.puts "REQUEST DATA: #{data}" rescue => details STDERR.puts "#{Time.now}: ERROR: #$!" STDERR.puts details.backtrace.join("\n") diff --git a/lib/mongrel/debug.rb b/lib/mongrel/debug.rb index 3e3cdbd6..d0f6e9e4 100644 --- a/lib/mongrel/debug.rb +++ b/lib/mongrel/debug.rb @@ -48,7 +48,12 @@ module ObjectTracker @active_objects = Set.new ObjectSpace.each_object do |obj| - @active_objects << obj.object_id + begin + # believe it or not, some idiots actually alter the object_id method + @active_objects << obj.object_id + rescue Object + # skip this one, he's an idiot + end end end