diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-07-03 22:30:48 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-07-04 01:13:42 -0700 |
commit | ff0fc020fe30798e52d96cc11b445c76d9822422 (patch) | |
tree | 986dfb9b874de6801646e86ea4ba7654b61bd59b /lib/unicorn/http_request.rb | |
parent | 672befaa67ace119c07ee346124526c1e0c4a1f1 (diff) | |
download | unicorn-ff0fc020fe30798e52d96cc11b445c76d9822422.tar.gz |
There's a small memory reduction to be had when forking oodles of processes and the Perl hacker in me still gets confused into thinking those are arrays...
Diffstat (limited to 'lib/unicorn/http_request.rb')
-rw-r--r-- | lib/unicorn/http_request.rb | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb index 779cd32..b8df403 100644 --- a/lib/unicorn/http_request.rb +++ b/lib/unicorn/http_request.rb @@ -6,8 +6,6 @@ require 'unicorn/http11' module Unicorn class HttpRequest - attr_accessor :logger - # default parameters we merge into the request env for Rack handlers DEFAULTS = { "rack.errors" => $stderr, @@ -24,6 +22,9 @@ module Unicorn NULL_IO = StringIO.new(Z) LOCALHOST = '127.0.0.1'.freeze + def initialize + end + # Being explicitly single-threaded, we have certain advantages in # not having to worry about variables being clobbered :) BUFFER = ' ' * Const::CHUNK_SIZE # initial size, may grow @@ -31,10 +32,6 @@ module Unicorn PARSER = HttpParser.new PARAMS = Hash.new - def initialize(logger = Configurator::DEFAULT_LOGGER) - @logger = logger - end - # Does the majority of the IO processing. It has been written in # Ruby using about 8 different IO processing strategies. # @@ -74,13 +71,6 @@ module Unicorn data << socket.readpartial(Const::CHUNK_SIZE, BUFFER) PARSER.execute(PARAMS, data) and return handle_body(socket) end while true - rescue HttpParserError => e - @logger.error "HTTP parse error, malformed request " \ - "(#{PARAMS[Const::HTTP_X_FORWARDED_FOR] || - PARAMS[Const::REMOTE_ADDR]}): #{e.inspect}" - @logger.error "REQUEST DATA: #{data.inspect}\n---\n" \ - "PARAMS: #{PARAMS.inspect}\n---\n" - raise e end private |