mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
webrick/httpservlet/cgihandler: reduce memory use
WEBrick::HTTPRequest#body can be passed a block to process the body in chunks. Use this feature to avoid building a giant string in memory. * lib/webrick/httpservlet/cgihandler.rb (do_GET): avoid reading entire request body into memory (do_POST is aliased to do_GET, so it handles bodies) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7e1f2a5aa9
commit
89450a80fc
1 changed files with 1 additions and 3 deletions
|
@ -65,9 +65,7 @@ module WEBrick
|
|||
cgi_in.write("%8d" % dump.bytesize)
|
||||
cgi_in.write(dump)
|
||||
|
||||
if req.body and req.body.bytesize > 0
|
||||
cgi_in.write(req.body)
|
||||
end
|
||||
req.body { |chunk| cgi_in.write(chunk) }
|
||||
ensure
|
||||
cgi_in.close
|
||||
status = $?.exitstatus
|
||||
|
|
Loading…
Add table
Reference in a new issue