| 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 | |
| 28 | QT_BEGIN_NAMESPACE |
| 29 | |
| 30 | class QNetworkCookie; |
| 31 | |
| 32 | // this is the common part between QNetworkRequestPrivate, QNetworkReplyPrivate and QHttpPartPrivate |
| 33 | class |
| 34 | { |
| 35 | public: |
| 36 | typedef QPair<QByteArray, QByteArray> ; |
| 37 | typedef QList<RawHeaderPair> ; |
| 38 | typedef QHash<QNetworkRequest::KnownHeaders, QVariant> ; |
| 39 | typedef QHash<QNetworkRequest::Attribute, QVariant> ; |
| 40 | |
| 41 | mutable struct { |
| 42 | RawHeadersList ; |
| 43 | bool = false; |
| 44 | } ; |
| 45 | |
| 46 | QHttpHeaders ; |
| 47 | CookedHeadersMap ; |
| 48 | AttributesMap ; |
| 49 | QPointer<QObject> ; |
| 50 | |
| 51 | const RawHeadersList &() const; |
| 52 | QList<QByteArray> () const; |
| 53 | QByteArray (QAnyStringView ) const; |
| 54 | void (const QByteArray &key, const QByteArray &value); |
| 55 | void (QNetworkRequest::KnownHeaders , const QVariant &value); |
| 56 | |
| 57 | QHttpHeaders () const; |
| 58 | void (const QHttpHeaders &); |
| 59 | void (QHttpHeaders &&); |
| 60 | void (QHttpHeaders::WellKnownHeader name, QByteArrayView value); |
| 61 | |
| 62 | void (); |
| 63 | |
| 64 | static QDateTime (QByteArrayView value); |
| 65 | static QByteArray (const QDateTime &dt); |
| 66 | |
| 67 | static std::optional<qint64> (QByteArrayView value); |
| 68 | |
| 69 | typedef QList<QNetworkCookie> ; |
| 70 | static QByteArray (const NetworkCookieList &cookies); |
| 71 | static std::optional<NetworkCookieList> (const QList<QByteArray> &values); |
| 72 | static std::optional<NetworkCookieList> (const QList<QByteArray> &values); |
| 73 | |
| 74 | static RawHeadersList (const QHttpHeaders &); |
| 75 | static QHttpHeaders (const RawHeadersList &raw); |
| 76 | |
| 77 | private: |
| 78 | void (); |
| 79 | |
| 80 | void (const QHttpHeaders &); |
| 81 | void parseAndSetHeader(QByteArrayView key, QByteArrayView value); |
| 82 | void parseAndSetHeader(QNetworkRequest::KnownHeaders key, QByteArrayView value); |
| 83 | |
| 84 | }; |
| 85 | |
| 86 | Q_DECLARE_TYPEINFO(QNetworkHeadersPrivate::RawHeaderPair, Q_RELOCATABLE_TYPE); |
| 87 | |
| 88 | QT_END_NAMESPACE |
| 89 | |
| 90 | |
| 91 | #endif |
| 92 | |