Malloy
Loading...
Searching...
No Matches
cookie.hpp
1#pragma once
2
3#include <chrono>
4#include <filesystem>
5#include <string>
6
7namespace malloy::http
8{
9
18 // ToDo: This is only for Set-Cookie - make that more clear.
19 class cookie
20 {
21 public:
22 enum class same_site_t
23 {
24 strict,
25 lax,
26 none
27 };
28
29 std::string name;
30 std::string value;
31 std::chrono::seconds max_age{ 0 };
32 std::string expires;
33 std::string domain;
34 std::filesystem::path path;
35 bool secure = true;
36 bool http_only = true;
37 same_site_t same_site = same_site_t::strict;
38
39 [[nodiscard]]
40 std::string
41 to_string() const;
42 };
43
49 // ToDo: This is only for Set-Cookie - make that more clear.
51 public cookie
52 {
53 public:
54 explicit
55 cookie_clear(const std::string& name_)
56 {
57 name = name_;
58 expires = m_expired_date;
59 }
60
61 private:
62 static constexpr const char* m_expired_date = "Thu, 01 Jan 1970 00:00:00 GMT";
63 };
64
65}
Definition: cookie.hpp:52
Definition: cookie.hpp:20
Definition: cookie.hpp:8