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/stream_response_epoll.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/rainbows/stream_response_epoll.rb') diff --git a/lib/rainbows/stream_response_epoll.rb b/lib/rainbows/stream_response_epoll.rb index 1f32dcc..c36acaf 100644 --- a/lib/rainbows/stream_response_epoll.rb +++ b/lib/rainbows/stream_response_epoll.rb @@ -20,7 +20,6 @@ require "raindrops" # * sleepy_penguin 3.0.1 or later module Rainbows::StreamResponseEpoll # :stopdoc: - HEADER_END = "X-Accel-Buffering: no\r\n\r\n" autoload :Client, "rainbows/stream_response_epoll/client" def http_response_write(socket, status, headers, body) @@ -46,7 +45,7 @@ module Rainbows::StreamResponseEpoll end end end - buf << HEADER_END + buf << "X-Accel-Buffering: no\r\n\r\n".freeze case rv = socket.kgio_trywrite(buf) when nil then break @@ -101,8 +100,8 @@ module Rainbows::StreamResponseEpoll status, headers, body = @app.call(env = @request.read(client)) if 100 == status.to_i - client.write(Unicorn::Const::EXPECT_100_RESPONSE) - env.delete(Unicorn::Const::HTTP_EXPECT) + client.write("HTTP/1.1 100 Continue\r\n\r\n".freeze) + env.delete('HTTP_EXPECT'.freeze) status, headers, body = @app.call(env) end @request.headers? or headers = nil -- cgit v1.2.3-24-ge0c7