Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #2194: less_copying_in_cookie_construction.patch

File less_copying_in_cookie_construction.patch, 1.2 kB (added by skaes, 3 years ago)
  • actionpack/lib/action_controller/cgi_ext/cookie_performance_fix.rb

    old new  
    7171    # Convert the Cookie to its string representation. 
    7272    def to_s 
    7373      buf = "" 
    74       buf += @name + '=' 
     74      buf << @name << '=' 
    7575 
    7676      if @value.kind_of?(String) 
    77         buf += CGI::escape(@value) 
     77        buf << CGI::escape(@value) 
    7878      else 
    79         buf += @value.collect{|v| CGI::escape(v) }.join("&") 
     79        buf << @value.collect{|v| CGI::escape(v) }.join("&") 
    8080      end 
    8181 
    8282      if @domain 
    83         buf += '; domain=' + @domain 
     83        buf << '; domain=' << @domain 
    8484      end 
    8585 
    8686      if @path 
    87         buf += '; path=' + @path 
     87        buf << '; path=' << @path 
    8888      end 
    8989 
    9090      if @expires 
    91         buf += '; expires=' + CGI::rfc1123_date(@expires) 
     91        buf << '; expires=' << CGI::rfc1123_date(@expires) 
    9292      end 
    9393 
    9494      if @secure == true 
    95         buf += '; secure' 
     95        buf << '; secure' 
    9696      end 
    9797 
    9898      buf