cro-http-cookie

Cro::HTTP::Cookie

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.

Properties

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.

  • name - the cookie name; constrained to only contain the characters allowed in cookie-name per RFC 6265 (required)

  • value - the cookie value; constrained to only contain the characters in the range specified in cookie-octet in RFC 6265 (required)

  • expires - the expiration time of the cookie, specified as a Raku DateTime

  • max-age - the maximum age of the cookie in seconds, specified as a Raku Duration (in the constructor any Real may be passed; fractional parts will be rounded)

  • domain - the domain the cookie is restricted to, if any; specified as a Str constrained per RFC 6265

  • path - the path the cookie is restricted to, if any; specified as a Str constrained per RFC 6265

  • secure - whether the cookie is only to be sent on a secure connection; a Bool

  • http-only - whether the cookie should only be sent in HTTP requests, and so hidden from, for example, JavaScript running on the page; a Bool

Methods

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.

cro v0.8.8

Libraries and tools for building reactive services in Raku. This installs the cro command line and web tool, along with HTTP (including HTTPS and HTTP/2.0) and WebSocket support.

Authors

  • Jonathan Worthington

License

Artistic-2.0

Dependencies

IO::Socket::Async::SSLJSON::FastMETA6Shell::CommandFile::FindTerminal::ANSIColorOO::MonitorsYAMLishCro::WebSocket:ver<0.8.8>Docker::FileFile::Ignore

Test Dependencies

Provides

  • Cro::Tools::CLI
  • Cro::Tools::CroFile
  • Cro::Tools::Link::Editor
  • Cro::Tools::LinkTemplate
  • Cro::Tools::LinkTemplate::HTTP
  • Cro::Tools::LinkTemplate::HTTPS
  • Cro::Tools::LinkTemplate::WS
  • Cro::Tools::LinkTemplate::WSS
  • Cro::Tools::Runner
  • Cro::Tools::Serve
  • Cro::Tools::Services
  • Cro::Tools::Template
  • Cro::Tools::Template::Common
  • Cro::Tools::Template::HTTPService
  • Cro::Tools::Template::ReactReduxSPA
  • Cro::Tools::Template::ZeroMQWorkSinkService
  • Cro::Tools::Template::ZeroMQWorkerService
  • Cro::Tools::TemplateLocator
  • Cro::Tools::Web

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.