From 70c976bdd85bb8515fea01d6ad6074ef472fc2e0 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 14 Nov 2015 02:47:24 +0000 Subject: reduce constant lookup dependencies 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. --- lib/rainbows/reverse_proxy/ev_client.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/rainbows/reverse_proxy') diff --git a/lib/rainbows/reverse_proxy/ev_client.rb b/lib/rainbows/reverse_proxy/ev_client.rb index cf97c4d..ab3f7a3 100644 --- a/lib/rainbows/reverse_proxy/ev_client.rb +++ b/lib/rainbows/reverse_proxy/ev_client.rb @@ -3,18 +3,15 @@ require 'tempfile' module Rainbows::ReverseProxy::EvClient include Rainbows::ReverseProxy::Synchronous - AsyncCallback = "async.callback" CBB = Unicorn::TeeInput.client_body_buffer_size - Content_Length = "Content-Length" - Transfer_Encoding = "Transfer-Encoding" def receive_data(buf) if @body @body << buf else response = @parser.headers(@headers, @rbuf << buf) or return - if (cl = @headers[Content_Length] && cl.to_i > CBB) || - (%r{\bchunked\b} =~ @headers[Transfer_Encoding]) + if (cl = @headers['Content-Length'.freeze] && cl.to_i > CBB) || + (%r{\bchunked\b} =~ @headers['Transfer-Encoding'.freeze]) @body = LargeBody.new("") @body << @rbuf @response = response << @body -- cgit v1.2.3-24-ge0c7