add client_max_body_size config directive
commit9f1131f5972ba90c1c54c76cc97633447142b307
authorEric Wong <normalperson@yhbt.net>
Mon, 3 May 2010 22:19:53 +0000 (3 15:19 -0700)
committerEric Wong <normalperson@yhbt.net>
Mon, 3 May 2010 22:19:53 +0000 (3 15:19 -0700)
treec5ee918bfea67ffcd77b5b90ee2191ec2a5df129
parent1f3de8f8940fc7805c54d3d27e2074632ab5a0b0
add client_max_body_size config directive

Since Rainbows! is supported when exposed directly to the
Internet, administrators may want to limit the amount of data a
user may upload in a single request body to prevent a
denial-of-service via disk space exhaustion.

This amount may be specified in bytes, the default limit being
1024*1024 bytes (1 megabyte).  To override this default, a user
may specify `client_max_body_size' in the Rainbows! block
of their server config file:

  Rainbows! do
    client_max_body_size 10 * 1024 * 1024
  end

Clients that exceed the limit will get a "413 Request Entity Too
Large" response if the request body is too large and the
connection will close.

For chunked requests, we have no choice but to interrupt during
the client upload since we have no prior knowledge of the
request body size.
lib/rainbows.rb
lib/rainbows/base.rb
lib/rainbows/const.rb
lib/rainbows/ev_core.rb
lib/rainbows/http_server.rb
lib/rainbows/max_body.rb [new file with mode: 0644]
t/t0103-rack-input-limit.sh [new file with mode: 0755]
t/t0104-rack-input-limit-tiny.sh [new file with mode: 0755]
t/t0105-rack-input-limit-bigger.sh [new file with mode: 0755]
t/test-lib.sh