From e9a229c639dd6bda08a3fa8ce14af3688dc2ba63 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 3 May 2011 01:15:37 +0000 Subject: s/max_bytes/client_max_body_size/ for consistency Too confusing otherwise... --- lib/rainbows.rb | 5 +++-- lib/rainbows/ev_core.rb | 2 +- lib/rainbows/http_server.rb | 4 ++-- lib/rainbows/max_body.rb | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 0e6ca39..e151a32 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -68,7 +68,8 @@ module Rainbows # :stopdoc: class << self attr_accessor :client_header_buffer_size - attr_accessor :max_bytes, :keepalive_timeout + attr_accessor :client_max_body_size + attr_accessor :keepalive_timeout attr_accessor :server attr_accessor :cur # may not always be used attr_reader :alive @@ -77,7 +78,7 @@ module Rainbows # :startdoc: # the default max body size is 1 megabyte (1024 * 1024 bytes) - @max_bytes = 1024 * 1024 + @client_max_body_size = 1024 * 1024 # the default keepalive_timeout is 5 seconds @keepalive_timeout = 5 diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb index 24254dc..fb19b04 100644 --- a/lib/rainbows/ev_core.rb +++ b/lib/rainbows/ev_core.rb @@ -133,7 +133,7 @@ module Rainbows::EvCore end def mkinput - max = Rainbows.max_bytes + max = Rainbows.client_max_body_size len = @hp.content_length if len if max && (len > max) diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb index c36b7bf..acc64b5 100644 --- a/lib/rainbows/http_server.rb +++ b/lib/rainbows/http_server.rb @@ -35,7 +35,7 @@ class Rainbows::HttpServer < Unicorn::HttpServer def load_config! use :Base Rainbows.keepalive_timeout = 5 - Rainbows.max_bytes = 1024 * 1024 + Rainbows.client_max_body_size = 1024 * 1024 @worker_connections = nil super @worker_connections ||= @use == :Base ? 1 : 50 @@ -139,7 +139,7 @@ class Rainbows::HttpServer < Unicorn::HttpServer else raise ArgumentError, err end - Rainbows.max_bytes = nr + Rainbows.client_max_body_size = nr end def client_header_buffer_size(bytes) diff --git a/lib/rainbows/max_body.rb b/lib/rainbows/max_body.rb index fba8b3c..c70cbba 100644 --- a/lib/rainbows/max_body.rb +++ b/lib/rainbows/max_body.rb @@ -25,7 +25,7 @@ class Rainbows::MaxBody # # in config.ru: # use Rainbows::MaxBody, 4096 # run YourApplication.new - def initialize(app, limit = Rainbows.max_bytes) + def initialize(app, limit = Rainbows.client_max_body_size) Integer === limit or raise ArgumentError, "limit not an Integer" @app, @limit = app, limit end @@ -51,7 +51,7 @@ class Rainbows::MaxBody # this is called after forking, so it won't ever affect the master # if it's reconfigured def self.setup # :nodoc: - Rainbows.max_bytes or return + Rainbows.client_max_body_size or return case Rainbows.server.use when :Rev, :Coolio, :EventMachine, :NeverBlock, :RevThreadSpawn, :RevThreadPool, -- cgit v1.2.3-24-ge0c7