зеркало из https://github.com/github/ruby.git
Prefer Regexp#=~ to Regexp#match when the RHS may be nil
This commit is contained in:
Родитель
b4daa44270
Коммит
45454bdb8b
|
@ -73,8 +73,7 @@ class CGI
|
|||
@expires = nil
|
||||
if name.kind_of?(String)
|
||||
@name = name
|
||||
%r|^(.*/)|.match(ENV["SCRIPT_NAME"])
|
||||
@path = ($1 or "")
|
||||
@path = (%r|\A(.*/)| =~ ENV["SCRIPT_NAME"] ? $1 : "")
|
||||
@secure = false
|
||||
@httponly = false
|
||||
return super(value)
|
||||
|
@ -88,12 +87,7 @@ class CGI
|
|||
@name = options["name"]
|
||||
value = Array(options["value"])
|
||||
# simple support for IE
|
||||
if options["path"]
|
||||
@path = options["path"]
|
||||
else
|
||||
%r|^(.*/)|.match(ENV["SCRIPT_NAME"])
|
||||
@path = ($1 or "")
|
||||
end
|
||||
@path = options["path"] || (%r|\A(.*/)| =~ ENV["SCRIPT_NAME"] ? $1 : "")
|
||||
@domain = options["domain"]
|
||||
@expires = options["expires"]
|
||||
@secure = options["secure"] == true
|
||||
|
|
|
@ -261,7 +261,7 @@ class CGI
|
|||
private :_header_for_hash
|
||||
|
||||
def nph? #:nodoc:
|
||||
return /IIS\/(\d+)/.match($CGI_ENV['SERVER_SOFTWARE']) && $1.to_i < 5
|
||||
return /IIS\/(\d+)/ =~ $CGI_ENV['SERVER_SOFTWARE'] && $1.to_i < 5
|
||||
end
|
||||
|
||||
def _header_for_modruby(buf) #:nodoc:
|
||||
|
@ -607,6 +607,7 @@ class CGI
|
|||
end
|
||||
def unescape_filename? #:nodoc:
|
||||
user_agent = $CGI_ENV['HTTP_USER_AGENT']
|
||||
return false unless user_agent
|
||||
return /Mac/i.match(user_agent) && /Mozilla/i.match(user_agent) && !/MSIE/i.match(user_agent)
|
||||
end
|
||||
|
||||
|
@ -648,7 +649,7 @@ class CGI
|
|||
# Reads query parameters in the @params field, and cookies into @cookies.
|
||||
def initialize_query()
|
||||
if ("POST" == env_table['REQUEST_METHOD']) and
|
||||
%r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|.match(env_table['CONTENT_TYPE'])
|
||||
%r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?| =~ env_table['CONTENT_TYPE']
|
||||
current_max_multipart_length = @max_multipart_length.respond_to?(:call) ? @max_multipart_length.call : @max_multipart_length
|
||||
raise StandardError.new("too large multipart data.") if env_table['CONTENT_LENGTH'].to_i > current_max_multipart_length
|
||||
boundary = $1.dup
|
||||
|
|
Загрузка…
Ссылка в новой задаче