max_body: rewrite wrappers to be safer
commitc6ffae22748bc22d5ef88fea2a3ca67f480ee74b
authorEric Wong <normalperson@yhbt.net>
Fri, 19 Nov 2010 10:19:45 +0000 (19 10:19 +0000)
committerEric Wong <normalperson@yhbt.net>
Sat, 20 Nov 2010 00:59:01 +0000 (19 16:59 -0800)
treed64947098657f2bbdbca04a6db2e43645060a223
parent3cee07d750f678af92318c14110c803be3f9b97f
max_body: rewrite wrappers to be safer

To avoid denial-of-service attacks, the wrappers need to
intercept requests *before* they hit the memory allocator, so we
need to reimplement the read(all) and gets cases to use
smaller buffers whenever the application does not specify one.
lib/rainbows/max_body/rewindable_wrapper.rb
lib/rainbows/max_body/wrapper.rb
t/sha1-random-size.ru
t/t0104-rack-input-limit-tiny.sh
t/t0105-rack-input-limit-bigger.sh