class Loveline::Cookie

Included Modules

Defined in:

loveline/cookie.cr

Constant Summary

DAY_OF_MONTH = /\A(?<day>\d\d?)#{NON_DIGIT}/
DELIMITER = /[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]+/
NON_DIGIT = /\z|\D/
TIME = /\A(?<hour>\d\d?):(?<minute>\d\d?):(?<second>\d\d?)#{NON_DIGIT}/
YEAR = /\A(?<year>\d{2,4})#{NON_DIGIT}/

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

[View source]
def self.new(*, domain : String, path, name : String, value : String, creation_time : Time, last_access_time : Time, expiry : Time | Nil, secure : Bool, http_only : Bool, host_only : Bool) #

[View source]

Class Method Detail

def self.domain_match?(*, request_host : String, cookie_domain : String) : Bool #

[View source]
def self.from_headers(headers : HTTP::Headers, request_host : String, request_path : String, request_secure : Bool) : Array(Cookie) #

[View source]
def self.parse_date(str : String) : Time | Nil #

[View source]
def self.parse_set_cookie_string(set_cookie_string : String, request_host : String, request_path : String, request_secure : Bool) : Cookie | Nil #

The odd variable names in this method are taken directly from the algorithm specified in RFC6265 section 5.2: https://tools.ietf.org/html/rfc6265#section-5.2


[View source]
def self.path_match?(*, request_path : String, cookie_path : String) : Bool #

[View source]
def self.valid_hostname?(str : String) : Bool #

This isn't a rigorous validity check. I mostly just want to stop weird things happening if somebody makes a request to "..". https://www.ietf.org/rfc/rfc952.txt https://www.ietf.org/rfc/rfc1123.txt


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


[View source]
def creation_time : Time #

[View source]
def domain : String #

[View source]
def expired?(current_time : Time) : Bool #

[View source]
def expiry : Time | Nil #

[View source]
def host_only : Bool #

[View source]
def http_only : Bool #

[View source]
def last_access_time : Time #

[View source]
def name : String #

[View source]
def path : String #

[View source]
def persistent? #

[View source]
def secure : Bool #

[View source]
def update_creation_time!(cookie_jar) #

[View source]
def value : String #

[View source]