Skip to content
Browse files

Merge pull request #14520 from kreynolds/replace-regexp-with-index-or…

…-string

Replace trivial regexp with string or index, twice as fast
  • Loading branch information...
2 parents a263d0b + f14c74f commit 791d235afb3321847fa84cd8dbd246ca211892ac @fxn fxn committed Mar 28, 2014
View
2 actionpack/lib/action_controller/metal/http_authentication.rb
@@ -96,7 +96,7 @@ def authenticate(request, &login_procedure)
end
def user_name_and_password(request)
- decode_credentials(request).split(/:/, 2)
+ decode_credentials(request).split(':', 2)
end
def decode_credentials(request)
View
2 actionpack/lib/action_dispatch/http/mime_type.rb
@@ -178,7 +178,7 @@ def register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], s
end
def parse(accept_header)
- if accept_header !~ /,/
+ if !accept_header.include?(',')
accept_header = accept_header.split(PARAMETER_SEPARATOR_REGEXP).first
parse_trailing_star(accept_header) || [Mime::Type.lookup(accept_header)].compact
else

0 comments on commit 791d235

Please sign in to comment.
Something went wrong with that request. Please try again.