Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnetworkcookie_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QNETWORKCOOKIE_P_H
5#define QNETWORKCOOKIE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of the Network Access framework. This header file may change from
13// version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtNetwork/private/qtnetworkglobal_p.h>
19#include "QtCore/qdatetime.h"
20#include "QtNetwork/qnetworkcookie.h"
21
22QT_BEGIN_NAMESPACE
23
24class QNetworkCookiePrivate: public QSharedData
25{
26public:
27 QNetworkCookiePrivate() = default;
28 static QList<QNetworkCookie> parseSetCookieHeaderLine(QByteArrayView cookieString);
29
30 QDateTime expirationDate;
31 QString domain;
32 QString path;
33 QString comment;
34 QByteArray name;
35 QByteArray value;
36 QNetworkCookie::SameSite sameSite = QNetworkCookie::SameSite::Default;
37 bool secure = false;
38 bool httpOnly = false;
39};
40
41static inline bool isLWS(char c)
42{
43 return c == ' ' || c == '\t' || c == '\r' || c == '\n';
44}
45
46static int nextNonWhitespace(QByteArrayView text, int from)
47{
48 // RFC 2616 defines linear whitespace as:
49 // LWS = [CRLF] 1*( SP | HT )
50 // We ignore the fact that CRLF must come as a pair at this point
51 // It's an invalid HTTP header if that happens.
52 while (from < text.size()) {
53 if (isLWS(text.at(from)))
54 ++from;
55 else
56 return from; // non-whitespace
57 }
58
59 // reached the end
60 return text.size();
61}
62
63QT_END_NAMESPACE
64
65#endif
The QNetworkCookie class holds one network cookie.
#define ADAY
static bool checkStaticArray(int &val, QByteArrayView dateString, int at, const char *array, int size)
#define AMONTH
static bool isValueSeparator(char c)
static bool isWhitespace(char c)
static QDateTime parseDateString(QByteArrayView dateString)
#define AYEAR
static const char months[]
static std::pair< QByteArray, QByteArray > nextField(QByteArrayView text, int &position, bool isNameValue)
static const char zones[]
static bool isNumber(char s)
static const int zoneOffsets[]
static bool isTerminator(char c)
static int nextNonWhitespace(QByteArrayView text, int from)
static bool isLWS(char c)