Project

General

Profile

Backport #229 ยป cgi_cookie.patch

NoKarma (Arthur Schreiber), 07/07/2008 07:37 AM

View differences:

lib/cgi.rb (Arbeitskopie)
822 822
      super(@value)
823 823
    end
824 824

  
825
    attr_accessor("name", "value", "path", "domain", "expires")
826
    attr_reader("secure")
825
    attr_accessor("name", "path", "domain", "expires")
826
    attr_reader("secure", "value")
827 827

  
828 828
    # Set whether the Cookie is a secure cookie or not.
829 829
    #
......
832 832
      @secure = val if val == true or val == false
833 833
      @secure
834 834
    end
835
    
836
    def value=(val)
837
      @value.replace(Array(val))
838
    end
835 839

  
836 840
    # Convert the Cookie to its string representation.
837 841
    def to_s
838 842
      buf = ""
839 843
      buf += @name + '='
840 844

  
841
      if @value.kind_of?(String)
842
        buf += CGI::escape(@value)
843
      else
844
        buf += @value.collect{|v| CGI::escape(v) }.join("&")
845
      end
845
      buf += @value.map { |v| CGI::escape(v) }.join("&")
846 846

  
847 847
      if @domain
848 848
        buf += '; domain=' + @domain