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// Qt-Security score:significant reason:default
4
5#ifndef QNETWORKCOOKIE_P_H
6#define QNETWORKCOOKIE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists for the convenience
13// of the Network Access framework. This header file may change from
14// version to version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtNetwork/private/qtnetworkglobal_p.h>
20#include "QtCore/qdatetime.h"
21#include "QtNetwork/qnetworkcookie.h"
22
23QT_BEGIN_NAMESPACE
24
25class QNetworkCookiePrivate: public QSharedData
26{
27public:
28 QNetworkCookiePrivate() = default;
29 static QList<QNetworkCookie> parseSetCookieHeaderLine(QByteArrayView cookieString);
30
31 QDateTime expirationDate;
32 QString domain;
33 QString path;
34 QString comment;
35 QByteArray name;
36 QByteArray value;
37 QNetworkCookie::SameSite sameSite = QNetworkCookie::SameSite::Default;
38 bool secure = false;
39 bool httpOnly = false;
40};
41
42namespace {
43inline bool isLWS(char c)
44{
45 return c == ' ' || c == '\t' || c == '\r' || c == '\n';
46}
47
48// Used in qnetworkcookie.cpp and qnetworkreplyhttpimpl.cpp
49inline int nextNonWhitespace(QByteArrayView text, int from)
50{
51 // RFC 2616 defines linear whitespace as:
52 // LWS = [CRLF] 1*( SP | HT )
53 // We ignore the fact that CRLF must come as a pair at this point
54 // It's an invalid HTTP header if that happens.
55 while (from < text.size()) {
56 if (isLWS(text.at(from)))
57 ++from;
58 else
59 return from; // non-whitespace
60 }
61
62 // reached the end
63 return text.size();
64}
65}
66
67QT_END_NAMESPACE
68
69#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)