From f86c885ec5b4c95ac9736d09a4bbc70d3fe3f019 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Thu, 27 Nov 2014 16:19:11 -0500 Subject: Document the multipart_part_limit configuration in the README --- README.rdoc | 28 ++++++++++++++++++++++++++++ lib/rack/utils.rb | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index d5bd6d2e..6799448c 100644 --- a/README.rdoc +++ b/README.rdoc @@ -181,6 +181,34 @@ Installing the Ruby fcgi gem: Furthermore, to test Memcache sessions, you need memcached (will be run on port 11211) and memcache-client installed. +== Configuration + +Several parameters can be modified on `Rack::Utils` to configure Rack behaviour. + +e.g: + +```ruby +Rack::Utils.key_space_limit = 128 +``` + +=== key_space_limit + +The default number of bytes to allow a single parameter key to take up. +This helps prevent a rogue client from flooding a Request. + +Default to 65536 characters (4 kiB in worst case). + +=== multipart_part_limit + +The maximum number of parts a request can contain. +Accepting too many part can lead to the server running out of file handles. + +The default is `128`, which mean that a single request can't upload more than 128 files at once. + +Set to `0` for not limit. + +Can also be set via the `RACK_MULTIPART_PART_LIMIT` environment variable. + == History * March 3rd, 2007: First public release 0.1. diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb index 586bd6e4..81a76081 100644 --- a/lib/rack/utils.rb +++ b/lib/rack/utils.rb @@ -68,7 +68,7 @@ module Rack # This helps prevent a rogue client from flooding a Request. self.key_space_limit = 65536 - # The maximum number of parts a request can contain. Accepting to many part + # The maximum number of parts a request can contain. Accepting too many part # can lead to the server running out of file handles. # Set to `0` for no limit. self.multipart_part_limit = (ENV['RACK_MULTIPART_LIMIT'] || 128).to_i -- cgit v1.2.3-24-ge0c7