Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qnetworkrequest_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 QNETWORKREQUEST_P_H
5#define QNETWORKREQUEST_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 API. 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 <QtNetwork/qhttpheaders.h>
20#include "qnetworkrequest.h"
21#include "QtCore/qbytearray.h"
22#include "QtCore/qlist.h"
23#include "QtCore/qhash.h"
24#include "QtCore/qshareddata.h"
25#include "QtCore/qsharedpointer.h"
26#include "QtCore/qpointer.h"
27
29
30class QNetworkCookie;
31
32// this is the common part between QNetworkRequestPrivate, QNetworkReplyPrivate and QHttpPartPrivate
34{
35public:
36 typedef QPair<QByteArray, QByteArray> RawHeaderPair;
37 typedef QList<RawHeaderPair> RawHeadersList;
38 typedef QHash<QNetworkRequest::KnownHeaders, QVariant> CookedHeadersMap;
39 typedef QHash<QNetworkRequest::Attribute, QVariant> AttributesMap;
40
41 mutable struct {
43 bool isCached = false;
45
49 QPointer<QObject> originatingObject;
50
51 const RawHeadersList &allRawHeaders() const;
52 QList<QByteArray> rawHeadersKeys() const;
53 QByteArray rawHeader(QAnyStringView headerName) const;
54 void setRawHeader(const QByteArray &key, const QByteArray &value);
56
57 QHttpHeaders headers() const;
58 void setHeaders(const QHttpHeaders &newHeaders);
59 void setHeaders(QHttpHeaders &&newHeaders);
61
62 void clearHeaders();
63
65 static QByteArray toHttpDate(const QDateTime &dt);
66
67 static std::optional<qint64> toInt(QByteArrayView value);
68
69 typedef QList<QNetworkCookie> NetworkCookieList;
70 static QByteArray fromCookieList(const NetworkCookieList &cookies);
71 static std::optional<NetworkCookieList> toSetCookieList(const QList<QByteArray> &values);
72 static std::optional<NetworkCookieList> toCookieList(const QList<QByteArray> &values);
73
75 static QHttpHeaders fromRawToHttp(const RawHeadersList &raw);
76
77private:
78 void invalidateHeaderCache();
79
80 void setCookedFromHttp(const QHttpHeaders &newHeaders);
81 void parseAndSetHeader(QByteArrayView key, QByteArrayView value);
83
84};
85
87
89
90
91#endif
\inmodule QtCore
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore\reentrant
Definition qdatetime.h:283
WellKnownHeader
List of well known headers as per \l {https://www.iana.org/assignments/http-fields}{IANA registry}.
The QNetworkCookie class holds one network cookie.
QByteArray rawHeader(QAnyStringView headerName) const
QHash< QNetworkRequest::Attribute, QVariant > AttributesMap
struct QNetworkHeadersPrivate::@400 rawHeaderCache
static std::optional< qint64 > toInt(QByteArrayView value)
static QHttpHeaders fromRawToHttp(const RawHeadersList &raw)
QList< QNetworkCookie > NetworkCookieList
static QByteArray fromCookieList(const NetworkCookieList &cookies)
void setCookedHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
QPointer< QObject > originatingObject
QList< QByteArray > rawHeadersKeys() const
static RawHeadersList fromHttpToRaw(const QHttpHeaders &headers)
static std::optional< NetworkCookieList > toCookieList(const QList< QByteArray > &values)
QHttpHeaders headers() const
static std::optional< NetworkCookieList > toSetCookieList(const QList< QByteArray > &values)
void setHeaders(const QHttpHeaders &newHeaders)
const RawHeadersList & allRawHeaders() const
void setRawHeader(const QByteArray &key, const QByteArray &value)
void setHeader(QHttpHeaders::WellKnownHeader name, QByteArrayView value)
QList< RawHeaderPair > RawHeadersList
QHash< QNetworkRequest::KnownHeaders, QVariant > CookedHeadersMap
static QByteArray toHttpDate(const QDateTime &dt)
static QDateTime fromHttpDate(QByteArrayView value)
QPair< QByteArray, QByteArray > RawHeaderPair
CookedHeadersMap cookedHeaders
KnownHeaders
List of known header types that QNetworkRequest parses.
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLsizei GLsizei GLint * values
[15]
GLuint64 key
GLuint name
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180