diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-18 16:05:28 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-18 16:05:28 -0700 |
commit | 872d8c30971e376cf6d2f7b99a0aafdb7bfc1939 (patch) | |
tree | e5e9390957bc51011be2556dd42c308da1bb6a8e | |
parent | 13655a4e394d69de48484c11fdf0d8e6981c8d94 (diff) | |
download | rails-872d8c30971e376cf6d2f7b99a0aafdb7bfc1939.tar.gz rails-872d8c30971e376cf6d2f7b99a0aafdb7bfc1939.tar.bz2 rails-872d8c30971e376cf6d2f7b99a0aafdb7bfc1939.zip |
eagerly populate the http method loookup cache so we don't need locks
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index b8ebeb408f..fc8825d6d9 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -70,7 +70,13 @@ module ActionDispatch RFC5789 = %w(PATCH) HTTP_METHODS = RFC2616 + RFC2518 + RFC3253 + RFC3648 + RFC3744 + RFC5323 + RFC5789 - HTTP_METHOD_LOOKUP = Hash.new { |h, m| h[m] = m.underscore.to_sym if HTTP_METHODS.include?(m) } + + HTTP_METHOD_LOOKUP = {} + + # Populate the HTTP method lookup cache + HTTP_METHODS.each { |method| + HTTP_METHOD_LOOKUP[method] = method.underscore.to_sym + } # Returns the HTTP \method that the application should see. # In the case where the \method was overridden by a middleware |