diff options
author | Eric Wong <e@80x24.org> | 2015-11-14 02:47:24 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-11-18 02:20:25 +0000 |
commit | 70c976bdd85bb8515fea01d6ad6074ef472fc2e0 (patch) | |
tree | 51230dc24bb183176b932e0d38e181869b5485e7 /lib/rainbows/process_client.rb | |
parent | 9c9e3949b2ef2f299ff1590d23aa4d053b60a2fd (diff) | |
download | rainbows-70c976bdd85bb8515fea01d6ad6074ef472fc2e0.tar.gz |
Unicorn 5 removes some constants we were using, and constant lookups + inline caching are waste of time anyways on newer Rubies with the opt_str_freeze bytecode instruction. This may reduce performance for folks on older Rubies (probably not noticeable); but improves performance for folks on newer Rubies.
Diffstat (limited to 'lib/rainbows/process_client.rb')
-rw-r--r-- | lib/rainbows/process_client.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/rainbows/process_client.rb b/lib/rainbows/process_client.rb index f58770c..492b8a6 100644 --- a/lib/rainbows/process_client.rb +++ b/lib/rainbows/process_client.rb @@ -5,7 +5,6 @@ module Rainbows::ProcessClient include Rainbows::Const NULL_IO = Unicorn::HttpRequest::NULL_IO - RACK_INPUT = Unicorn::HttpRequest::RACK_INPUT IC = Unicorn::HttpRequest.input_class Rainbows.config!(self, :client_header_buffer_size, :keepalive_timeout) @@ -39,13 +38,13 @@ module Rainbows::ProcessClient end set_input(env, hp) - env[REMOTE_ADDR] = kgio_addr + env['REMOTE_ADDR'] = kgio_addr hp.hijack_setup(env, to_io) status, headers, body = APP.call(env.merge!(RACK_DEFAULTS)) if 100 == status.to_i - write(EXPECT_100_RESPONSE) - env.delete(HTTP_EXPECT) + write("HTTP/1.1 100 Continue\r\n\r\n".freeze) + env.delete('HTTP_EXPECT'.freeze) status, headers, body = APP.call(env) end return if hp.hijacked? @@ -66,18 +65,18 @@ module Rainbows::ProcessClient end def set_input(env, hp) - env[RACK_INPUT] = 0 == hp.content_length ? NULL_IO : IC.new(self, hp) + env['rack.input'] = 0 == hp.content_length ? NULL_IO : IC.new(self, hp) end def process_pipeline(env, hp) begin set_input(env, hp) - env[REMOTE_ADDR] = kgio_addr + env['REMOTE_ADDR'] = kgio_addr hp.hijack_setup(env, to_io) status, headers, body = APP.call(env.merge!(RACK_DEFAULTS)) if 100 == status.to_i - write(EXPECT_100_RESPONSE) - env.delete(HTTP_EXPECT) + write("HTTP/1.1 100 Continue\r\n\r\n".freeze) + env.delete('HTTP_EXPECT'.freeze) status, headers, body = APP.call(env) end return if hp.hijacked? |