Sha256: 7f17764360c61374c5b853aa3b88a76b17df8276b30e36a2d6b185e08285c50d
Contents?: true
Size: 921 Bytes
Versions: 3
Compression:
Stored size: 921 Bytes
Contents
module Nyara # http://www.ietf.org/rfc/rfc6265.txt (don't look at rfc2109) module Cookie extend self def decode header res = ParamHash.new if data = header['Cookie'] Ext.parse_cookie res, data end res end def add_set_cookie header_lines, k, v, expires: nil, max_age: nil, domain: nil, path: nil, secure: nil, httponly: true r = "Set-Cookie: " if v.nil? or v == true r << "#{CGI.escape k.to_s}; " else r << "#{CGI.escape k.to_s}=#{CGI.escape v.to_s}; " end r << "Expires=#{expires.to_time.gmtime.rfc2822}; " if expires r << "Max-Age=#{max_age.to_i}; " if max_age # todo lint rfc1123 §2.1, rfc1034 §3.5 r << "Domain=#{domain}; " if domain r << "Path=#{path}; " if path r << "Secure; " if secure r << "HttpOnly; " if httponly r << "\r\n" header_lines << r end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nyara-0.0.1.pre.5 | lib/nyara/cookie.rb |
nyara-0.0.1.pre.4 | lib/nyara/cookie.rb |
nyara-0.0.1.pre.3 | lib/nyara/cookie.rb |