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
qnetworkaccessmanager_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 QNETWORKACCESSMANAGER_P_H
6#define QNETWORKACCESSMANAGER_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>
24#include "qhsts_p.h"
25#include "private/qobject_p.h"
26#include "QtNetwork/qnetworkproxy.h"
28
29#if QT_CONFIG(settings)
30#include "qhstsstore_p.h"
31#endif // QT_CONFIG(settings)
32
33#if QT_CONFIG(settings)
34#include <memory>
35#endif
36
38
39class QAuthenticator;
40class QAbstractNetworkCache;
42class QNetworkCookieJar;
43
45{
46public:
48 : networkCache(nullptr),
49 cookieJar(nullptr),
50 thread(nullptr),
51#ifndef QT_NO_NETWORKPROXY
52 proxyFactory(nullptr),
53#endif
54 cookieJarCreated(false),
58 {
59 }
61
63 void destroyThread();
64
65 void _q_replyFinished(QNetworkReply *reply);
66 void _q_replyEncrypted(QNetworkReply *reply);
67 void _q_replySslErrors(const QList<QSslError> &errors);
68 void _q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator);
69 QNetworkReply *postProcess(QNetworkReply *reply);
70 void createCookieJar() const;
71
72 void authenticationRequired(QAuthenticator *authenticator,
73 QNetworkReply *reply,
74 bool synchronous,
75 QUrl &url,
76 QUrl *urlForLastAuthentication,
77 bool allowAuthenticationReuse = true);
78 void cacheCredentials(const QUrl &url, const QAuthenticator *auth);
80 const QAuthenticator *auth = nullptr);
81
82#ifndef QT_NO_NETWORKPROXY
83 void proxyAuthenticationRequired(const QUrl &url,
84 const QNetworkProxy &proxy,
85 bool synchronous,
86 QAuthenticator *authenticator,
87 QNetworkProxy *lastProxyAuthentication);
88 void cacheProxyCredentials(const QNetworkProxy &proxy, const QAuthenticator *auth);
90 const QAuthenticator *auth = nullptr);
91 QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query);
92#endif
93
94 QNetworkAccessBackend *findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request);
96
97#if QT_CONFIG(http) || defined(Q_OS_WASM)
99#endif
100
102
103 // this is the cache for storing downloaded files
104 QAbstractNetworkCache *networkCache;
105
106 QNetworkCookieJar *cookieJar;
107
109
110
111#ifndef QT_NO_NETWORKPROXY
112 QNetworkProxy proxy;
113 QNetworkProxyFactory *proxyFactory;
114#endif
115
119
120 // The cache with authorization data:
122
123 Q_AUTOTEST_EXPORT static void clearAuthenticationCache(QNetworkAccessManager *manager);
124 Q_AUTOTEST_EXPORT static void clearConnectionCache(QNetworkAccessManager *manager);
125
127#if QT_CONFIG(settings)
129#endif // QT_CONFIG(settings)
130 bool stsEnabled = false;
131
132 bool autoDeleteReplies = false;
133
134 std::chrono::milliseconds transferTimeout{0};
135
136 Q_DECLARE_PUBLIC(QNetworkAccessManager)
137};
138
139QT_END_NAMESPACE
140
141#endif
void cacheCredentials(const QUrl &url, const QAuthenticator *auth)
QNetworkAuthenticationCredential fetchCachedCredentials(const QUrl &url, const QAuthenticator *auth=nullptr)
Fetch the credential data from the credential cache.
QNetworkAuthenticationCredential fetchCachedProxyCredentials(const QNetworkProxy &proxy, const QAuthenticator *auth=nullptr)
void cacheProxyCredentials(const QNetworkProxy &proxy, const QAuthenticator *auth)
QNetworkRequest::RedirectPolicy redirectPolicy
QNetworkAuthenticationCredential * fetchCachedCredentials(const QUrl &url, const QAuthenticator *auth=nullptr)
QStringList backendSupportedSchemes() const
QList< QNetworkProxy > queryProxy(const QNetworkProxyQuery &query)
QNetworkReply * postProcess(QNetworkReply *reply)
QNetworkAccessBackend * findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request)
void proxyAuthenticationRequired(const QUrl &url, const QNetworkProxy &proxy, bool synchronous, QAuthenticator *authenticator, QNetworkProxy *lastProxyAuthentication)
void _q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator)
std::chrono::milliseconds transferTimeout
void authenticationRequired(QAuthenticator *authenticator, QNetworkReply *reply, bool synchronous, QUrl &url, QUrl *urlForLastAuthentication, bool allowAuthenticationReuse=true)
void cacheProxyCredentials(const QNetworkProxy &proxy, const QAuthenticator *auth)
std::shared_ptr< QNetworkAccessAuthenticationManager > authenticationManager
void cacheCredentials(const QUrl &url, const QAuthenticator *auth)
QNetworkAuthenticationCredential * fetchCachedProxyCredentials(const QNetworkProxy &proxy, const QAuthenticator *auth=nullptr)
void _q_replyFinished(QNetworkReply *reply)
void _q_replyEncrypted(QNetworkReply *reply)
void _q_replySslErrors(const QList< QSslError > &errors)
static Q_AUTOTEST_EXPORT void clearConnectionCache(QNetworkAccessManager *manager)
static Q_AUTOTEST_EXPORT void clearAuthenticationCache(QNetworkAccessManager *manager)
iterator findClosestMatch(const QString &domain)
void insert(const QString &domain, const QString &user, const QString &password)
static QByteArray proxyAuthenticationKey(const QNetworkProxy &proxy, const QString &realm)
static QByteArray authenticationKey(const QUrl &url, const QString &realm)