Changeset 573

Show
Ignore:
Timestamp:
09/08/07 07:36:07 (1 year ago)
Author:
r.@tinyclouds.org
Message:

Conform to RFC 2109 cookie expiration time format. Closes #160.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/constants.rb

    r468 r573  
    1616     
    1717    SET_COOKIE = " %s=%s; path=/; expires=%s".freeze 
     18    COOKIE_EXPIRATION_FORMAT = "%a, %d-%b-%Y %H:%M:%S GMT".freeze 
    1819    COOKIE_SPLIT = /[;,] */n.freeze 
    1920    COOKIE_REGEXP = /\s*(.+)=(.*)\s*/.freeze 
  • trunk/lib/merb/mixins/controller.rb

    r497 r573  
    179179    # Sets a cookie to be included in the response. 
    180180    def set_cookie(name, value, expires) 
    181       (headers['Set-Cookie'] ||='') <<  
    182         (Merb::Const::SET_COOKIE % [name.to_s, escape(value.to_s), expires.rfc2822]) 
     181      (headers['Set-Cookie'] ||='') << (Merb::Const::SET_COOKIE % [ 
     182        name.to_s,  
     183        escape(value.to_s),  
     184        # Cookie expiration time must be GMT. See RFC 2109 
     185        expires.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT) 
     186      ]) 
    183187    end 
    184188