|
cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
|
The Cutelyst Cookie. More...
#include <Cutelyst/Cookie>

Public Types | |
| enum class | SameSite { Default , None , Lax , Strict } |
Public Member Functions | |
| Cookie (const Cookie &other) | |
| Creates a new Cookie object by copying the contents of other. | |
| Cookie (const QByteArray &name=QByteArray(), const QByteArray &value=QByteArray()) | |
| Create a new Cookie object, initializing the cookie name to name and its value to value. | |
| ~Cookie () | |
| Destroys this Cookie object. | |
| bool | operator!= (const Cookie &other) const |
| Returns true if this cookie is not equal to other. | |
| Cookie & | operator= (const Cookie &other) |
| Copies the contents of the Cookie object other to this object. | |
| Cookie & | operator= (Cookie &&other) noexcept |
| Move assigns the contents of the Cookie object other to this object. | |
| bool | operator== (const Cookie &other) const |
| Returns true if this cookie is equal to other. | |
| SameSite | sameSitePolicy () const |
| Returns the "SameSite" option if specified in the cookie string, SameSite::Default if not present. | |
| void | setSameSitePolicy (SameSite sameSite) |
| Sets the "SameSite" option of this cookie to sameSite. | |
| void | swap (Cookie &other) noexcept |
| Swaps this cookie with other. | |
| QByteArray | toRawForm (RawForm form=Full) const |
| Returns the raw form of this Cookie. | |
This is an extension of QNetworkCookie that adds support for the SameSite property. QNetworkCookie added support for the SameSite property in Qt 6.1. So, if you are only using Qt 6.1 or newer, please use QNetworkCookie and the methods that take it as argument instead.
|
strong |
| Enumerator | |
|---|---|
| Default | SameSite is not set. Can be interpreted as None or Lax by the browser. |
| None | Cookies can be sent in all contexts. This used to be default, but recent browsers made Lax default, and will now require the cookie to be both secure and to set SameSite=None. |
| Lax | Cookies are sent on first party requests and GET requests initiated by third party website. This is the default in modern browsers (since mid 2020). |
| Strict | Cookies will only be sent in a first-party context. |
|
explicit |
A cookie is only valid if it has a name. However, the value is opaque to the application and being empty may have significance to the remote server.
Definition at line 15 of file cookie.cpp.
Referenced by Cookie(), operator!=(), operator=(), operator=(), operator==(), and swap().
| Cookie::Cookie | ( | const Cookie & | other | ) |
Definition at line 23 of file cookie.cpp.
References Cookie().
|
inline |
Definition at line 31 of file cookie.cpp.
References Cookie().
| bool Cookie::operator== | ( | const Cookie & | other | ) | const |
This function only returns true if all fields of the cookie are the same.
However, in some contexts, two cookies of the same name could be considered equal.
Definition at line 38 of file cookie.cpp.
References Cookie().
| Cookie::SameSite Cookie::sameSitePolicy | ( | ) | const |
Definition at line 47 of file cookie.cpp.
| void Cookie::setSameSitePolicy | ( | Cookie::SameSite | sameSite | ) |
Definition at line 52 of file cookie.cpp.
|
inlinenoexcept |
This function is very fast and never fails.
Definition at line 75 of file cookie.h.
References Cookie().
Referenced by operator=().
| QByteArray Cookie::toRawForm | ( | RawForm | form = Full | ) | const |
The QByteArray returned by this function is suitable for an HTTP header, either in a server response (the Set-Cookie header) or the client request (the Cookie header). You can choose from one of two formats, using form.
Definition at line 74 of file cookie.cpp.
References Default.