about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-03 01:15:37 +0000
committerEric Wong <normalperson@yhbt.net>2011-05-03 01:15:37 +0000
commite9a229c639dd6bda08a3fa8ce14af3688dc2ba63 (patch)
tree530b649bdabf4c9886ae2cf6fe695b70ac54d179 /lib
parenta7f5f17ba2047ef7143465f612007ea81871a79e (diff)
downloadrainbows-e9a229c639dd6bda08a3fa8ce14af3688dc2ba63.tar.gz
Too confusing otherwise...
Diffstat (limited to 'lib')
-rw-r--r--lib/rainbows.rb5
-rw-r--r--lib/rainbows/ev_core.rb2
-rw-r--r--lib/rainbows/http_server.rb4
-rw-r--r--lib/rainbows/max_body.rb4
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,