The Cro::HTTP::Cookie class represents a cookie, as defined in RFC 6265. In the context of a response or a useragent, all fields are relevant. In the context of a request being sent to a server, only the name and value have any significance, and the rest of the fields will be disregarded.


The Cro::HTTP::Cookie class has the following properties, which are all read only. They can all be passed in the constructor (new) or, to get a modified version of an existing instance, passed to clone.


The to-set-cookie() method serializes the Cro::HTTP::Cookie instance into a value to be set as a Set-cookie header. The to-cookie() method serializes the cookie into the form name=value for inclusion in a Cookie header.

The method from-set-cookie method, to be called on the Cro::HTTP::Cookie type object, parses the value of a Set-cookie header and, provided the parse was successful, returns a Cro::HTTP::Cookie instance representing the parsed data. If it cannot be parsed per the syntax in RFC 6265, then an error will be thrown. Extensions (extension-av in RFC 6265) are permitted but will be ignored.