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/server_token.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/server_token.rb')
-rw-r--r-- | lib/rainbows/server_token.rb | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/rainbows/server_token.rb b/lib/rainbows/server_token.rb index 0ee87ac..09897d4 100644 --- a/lib/rainbows/server_token.rb +++ b/lib/rainbows/server_token.rb @@ -19,11 +19,6 @@ module Rainbows class ServerToken < Struct.new(:app, :token) - # :stopdoc: - # - # Freeze constants as they're slightly faster when setting hashes - SERVER = "Server".freeze - def initialize(app, token = Const::RACK_DEFAULTS['SERVER_SOFTWARE']) super end @@ -31,7 +26,7 @@ class ServerToken < Struct.new(:app, :token) def call(env) status, headers, body = app.call(env) headers = Rack::Utils::HeaderHash.new(headers) unless Hash === headers - headers[SERVER] = token + headers['Server'.freeze] = token [ status, headers, body ] end # :startdoc: |