| 1 | // Copyright (C) 2017 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 QHSTSSTORE_P_H |
| 6 | #define QHSTSSTORE_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 API. 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 | |
| 21 | QT_REQUIRE_CONFIG(settings); |
| 22 | |
| 23 | #include <QtCore/qlist.h> |
| 24 | #include <QtCore/qsettings.h> |
| 25 | |
| 26 | QT_BEGIN_NAMESPACE |
| 27 | |
| 28 | class QHstsPolicy; |
| 29 | class QByteArray; |
| 30 | class QString; |
| 31 | |
| 32 | class Q_AUTOTEST_EXPORT QHstsStore |
| 33 | { |
| 34 | public: |
| 35 | explicit QHstsStore(const QString &dirName); |
| 36 | ~QHstsStore(); |
| 37 | |
| 38 | QList<QHstsPolicy> readPolicies(); |
| 39 | void addToObserved(const QHstsPolicy &policy); |
| 40 | void synchronize(); |
| 41 | |
| 42 | bool isWritable() const; |
| 43 | |
| 44 | static QString absoluteFilePath(const QString &dirName); |
| 45 | private: |
| 46 | void beginHstsGroups(); |
| 47 | bool serializePolicy(const QString &key, const QHstsPolicy &policy); |
| 48 | bool deserializePolicy(const QString &key, QHstsPolicy &policy); |
| 49 | void evictPolicy(const QString &key); |
| 50 | void endHstsGroups(); |
| 51 | |
| 52 | QList<QHstsPolicy> observedPolicies; |
| 53 | QSettings store; |
| 54 | |
| 55 | Q_DISABLE_COPY_MOVE(QHstsStore) |
| 56 | }; |
| 57 | |
| 58 | QT_END_NAMESPACE |
| 59 | |
| 60 | #endif // QHSTSSTORE_P_H |
| 61 | |