From 5ece8c1c33f10e6496dfe5ae1d0d368293278d2d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 8 Jul 2010 05:33:49 +0000 Subject: prefer "[]" to "first"/"last" where possible "[]" is slightly faster under Ruby 1.9 (but slightly slower under 1.8). --- lib/unicorn/http_request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/unicorn') diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb index 65b09fa..8c369cf 100644 --- a/lib/unicorn/http_request.rb +++ b/lib/unicorn/http_request.rb @@ -53,7 +53,7 @@ module Unicorn # that client may be a proxy, gateway, or other intermediary # acting on behalf of the actual source client." REQ[Const::REMOTE_ADDR] = - TCPSocket === socket ? socket.peeraddr.last : LOCALHOST + TCPSocket === socket ? socket.peeraddr[-1] : LOCALHOST # short circuit the common case with small GET requests first if PARSER.headers(REQ, socket.readpartial(Const::CHUNK_SIZE, BUF)).nil? -- cgit v1.2.3-24-ge0c7