about summary refs log tree commit homepage
path: root/examples
DateCommit message (Collapse)
2009-07-01Remove cat-chunk-proxy, curl CVS supports non-blocking stdin
Now that upstream curl supports this functionality, there's no reason to duplicate it here as an example.
2009-07-01Force streaming input onto apps by default
This change gives applications full control to deny clients from uploading unwanted message bodies. This also paves the way for doing things like upload progress notification within applications in a Rack::Lint-compatible manner. Since we don't support HTTP keepalive, so we have more freedom here by being able to close TCP connections and deny clients the ability to write to us (and thus wasting our bandwidth). While I could've left this feature off by default indefinitely for maximum backwards compatibility (for arguably broken applications), Unicorn is not and has never been about supporting the lowest common denominator.
2009-06-07examples/cat-chunk-proxy: link to proposed curl(1) patch
Then hopefully soon we'll be able to get rid of this script...
2009-06-06Unicorn::App::Inetd: reinventing Unix, poorly :)
This includes an example of tunneling the git protocol inside a TE:chunked HTTP request. The example is unfortunately contrived in that it relies on the custom examples/cat-chunk-proxy.rb script in the client. My initial wish was to have a generic tool like curl(1) operate like this: cat > ~/bin/cat-chunk-proxy.sh <<EOF #!/bin/sh exec curl -sfNT- http://$1:$2/ EOF chmod +x ~/bin/cat-chunk-proxy.sh GIT_PROXY_COMMAND=cat-chunk-proxy.sh git clone git://0:8080/foo Unfortunately, curl will attempt a blocking read on stdin before reading the TCP socket; causing the git-clone consumer to starve. This does not appear to be a problem with the new server code for handling chunked requests.
2009-06-05Transfer-Encoding: chunked streaming input support
This adds support for handling POST/PUT request bodies sent with chunked transfer encodings ("Transfer-Encoding: chunked"). Attention has been paid to ensure that a client cannot OOM us by sending an extremely large chunk. This implementation is pure Ruby as the Ragel-based implementation in rfuzz didn't offer a streaming interface. It should be reasonably close to RFC-compliant but please test it in an attempt to break it. The more interesting part is the ability to stream data to the hosted Rack application as it is being transferred to the server. This can be done regardless if the input is chunked or not, enabling the streaming of POST/PUT bodies can allow the hosted Rack application to process input as it receives it. See examples/echo.ru for an example echo server over HTTP. Enabling streaming also allows Rack applications to support upload progress monitoring previously supported by Mongrel handlers. Since Rack specifies that the input needs to be rewindable, this input is written to a temporary file (a la tee(1)) as it is streamed to the application the first time. Subsequent rewinded reads will read from the temporary file instead of the socket. Streaming input to the application is disabled by default since applications may not necessarily read the entire input body before returning. Since this is a completely new feature we've never seen in any Ruby HTTP application server before, we're taking the safe route by leaving it disabled by default. Enabling this can only be done globally by changing the Unicorn HttpRequest::DEFAULTS hash: Unicorn::HttpRequest::DEFAULTS["unicorn.stream_input"] = true Similarly, a Rack application can check if streaming input is enabled by checking the value of the "unicorn.stream_input" key in the environment hashed passed to it. All of this code has only been lightly tested and test coverage is lacking at the moment. [1] - http://tools.ietf.org/html/rfc2616#section-3.6.1
2009-04-29Add example init script
This was done in Bourne shell because it's easier for UNIX sysadmins who don't know Ruby to understand and modify. Additionally, it can be used for nginx or anything else that shares compatible signal handling.
2009-03-09Remove sinatra example
It is no longer relevant (or working) with rackup compatibility.
2009-02-11Add Sinatra example
2009-02-01Realistic defaults.
2009-01-31Added simple rack application
2008-11-22Removed examples and debug.rb.
2006-06-18Additional simple feature for upload progress plugin. New redirect header ↵
and configuration option. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@245 19e92222-5c0b-0410-8929-a290d50e31e9
2006-06-05A couple of samples related to documentation on the site.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@224 19e92222-5c0b-0410-8929-a290d50e31e9
2006-05-23Improved tests increasing test coverage.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@210 19e92222-5c0b-0410-8929-a290d50e31e9
2006-05-23A simple status and statistics handler for people.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@209 19e92222-5c0b-0410-8929-a290d50e31e9
2006-05-23Implemented a DeflateFilter for dynamic gzip of responses.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@208 19e92222-5c0b-0410-8929-a290d50e31e9
2006-04-11Support large file uploads, moving them into a Tempfile should they cross ↵
the MAX_BODY threshold. The only change here really is that HttpRequest#body is now an IO object rather than a string. I changed the various handlers to support this. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@157 19e92222-5c0b-0410-8929-a290d50e31e9
2006-04-10Update setup.rb to silence errors on shebang replacement. Camping handler ↵
now allows passing back of an IO object, to allow large file streaming. Simpler underscore replacement on Tepee wiki words. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@154 19e92222-5c0b-0410-8929-a290d50e31e9
2006-04-03Minor tweaks to the handlers and http parser to deal with more bad input ↵
possibilities. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@139 19e92222-5c0b-0410-8929-a290d50e31e9
2006-03-26Final touches to get mongrel_rails working. Fixed URI registration bug. ↵
Small change to config tool. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@123 19e92222-5c0b-0410-8929-a290d50e31e9
2006-03-25First crack at some advanced debugging features for mongrel and the console.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@121 19e92222-5c0b-0410-8929-a290d50e31e9
2006-03-22Updated examples to use the new Configurator. Camping blog can't test since ↵
only have 1.3 camping. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@119 19e92222-5c0b-0410-8929-a290d50e31e9
2006-03-19Beginning of a tuning effort.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@116 19e92222-5c0b-0410-8929-a290d50e31e9
2006-03-12Wrong version number on gem_plugin dependency which is causing update errors.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@104 19e92222-5c0b-0410-8929-a290d50e31e9
2006-03-09Slight mod to how mongrel/camping.rb works so that you can access the ↵
HttpServer (rather than acceptor thread). git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@90 19e92222-5c0b-0410-8929-a290d50e31e9
2006-03-07Updated the Blog sample app to use Camping::Session.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@86 19e92222-5c0b-0410-8929-a290d50e31e9
2006-03-07Support for Camping as a first-class citizen. The postamble is now one or ↵
two lines. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@85 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-22Moved the win32 service files so that they can be used directly as commands. ↵
Modified the win32 gems to require win32-service. Created a gem for win32-service. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@56 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-21Adding mongrel_rails_service (and svc) drafts. Still fail to stop due Rails ↵
CGI Handler (my guess). Also fixed the "graceful stop" in mongrel_simple_service because cause also errors (how gracefully it is?) git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@55 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-21Corrected simple service and controller due Macintosh carrier returns (CR) ↵
incompatible with win32 ruby (CRLF) (actally that made the scripts useless, now solved). git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@54 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-21As the CGI and Handlers get bigger we'll need to separate their code out. ↵
This change does that. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@53 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-20Initial setup for graceful stop. Removed timeout code since buggy on OSX.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@52 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-20Added the first win32 service sample based on the simple mongrel example. By ↵
Luis. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@51 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-14Bug fix for a missed require that didn't show up until ran without Rails. ↵
Site updated to announce this. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@37 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-12Initial command/plugin setup for Mongrel
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@30 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-10Created rails runner, started making it daemon capable.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@23 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-09Setup to do daemonize.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@22 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-08Fixed a bug in the Error404Handler. Created the first Rails runner script.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@21 19e92222-5c0b-0410-8929-a290d50e31e9
2006-02-03* Moved various constants around. * Created the remaining feasible CGI ↵
variables people need. * Now create a REQUEST_URI which other CGI variables derive from. Implemented a simple DirHandler for browsing a directory and sending the files. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@20 19e92222-5c0b-0410-8929-a290d50e31e9
2006-01-29Added the blogging example and a README.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@14 19e92222-5c0b-0410-8929-a290d50e31e9
2006-01-29Put request.body back into StringIO.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@13 19e92222-5c0b-0410-8929-a290d50e31e9
2006-01-29The Tepee example is updated to use Camping 1.3, where the response and ↵
environment variables are passed in and a controller is returned for output. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@12 19e92222-5c0b-0410-8929-a290d50e31e9
2006-01-29Moving the Tepee example into a Camping directory.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@11 19e92222-5c0b-0410-8929-a290d50e31e9
2006-01-28First work at making a functional response class.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@9 19e92222-5c0b-0410-8929-a290d50e31e9
2006-01-28initial import into trunk
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@4 19e92222-5c0b-0410-8929-a290d50e31e9