40 #include <QtNetwork/private/qtnetworkglobal_p.h>
53 #if QT_CONFIG(settings)
66 #include "QtCore/qbuffer.h"
67 #include "QtCore/qlist.h"
68 #include "QtCore/qurl.h"
69 #include "QtNetwork/private/qauthenticator_p.h"
70 #include "QtNetwork/qsslconfiguration.h"
71 #include "QtNetwork/private/http2protocol_p.h"
83 #include "QtCore/qapplicationstatic.h"
84 #include <QtCore/private/qfactoryloader_p.h>
86 #if defined(Q_OS_MACOS)
87 #include <CoreServices/CoreServices.h>
88 #include <SystemConfiguration/SystemConfiguration.h>
89 #include <Security/SecKeychain.h>
105 #ifdef QT_BUILD_INTERNAL
106 Q_GLOBAL_STATIC(QNetworkAccessDebugPipeBackendFactory, debugpipeBackend)
112 #if defined(Q_OS_MACOS)
116 SecKeychainItemRef itemRef;
117 bool retValue =
false;
118 SecProtocolType protocolType = kSecProtocolTypeAny;
120 protocolType = kSecProtocolTypeFTPProxy;
123 protocolType = kSecProtocolTypeHTTPProxy;
126 protocolType = kSecProtocolTypeHTTPSProxy;
129 err = SecKeychainFindInternetPassword(
NULL,
136 kSecAuthenticationTypeAny,
141 SecKeychainAttribute
attr;
142 SecKeychainAttributeList attrList;
146 attr.tag = kSecAccountItemAttr;
151 attrList.attr = &
attr;
153 if (SecKeychainItemCopyContent(itemRef,
NULL, &attrList, &
length, &outData) == noErr) {
156 SecKeychainItemFreeContent(&attrList,outData);
167 static void ensureInitialized()
169 #ifdef QT_BUILD_INTERNAL
170 (
void) debugpipeBackend();
174 (
void) fileBackend();
412 d_func()->ensureBackendPluginsLoaded();
414 qRegisterMetaType<QNetworkReply::NetworkError>();
415 #ifndef QT_NO_NETWORKPROXY
416 qRegisterMetaType<QNetworkProxy>();
419 qRegisterMetaType<QList<QSslError> >();
420 qRegisterMetaType<QSslConfiguration>();
421 qRegisterMetaType<QSslPreSharedKeyAuthenticator *>();
423 qRegisterMetaType<QList<QPair<QByteArray,QByteArray> > >();
425 qRegisterMetaType<QHttpNetworkRequest>();
427 qRegisterMetaType<QNetworkReply::NetworkError>();
428 qRegisterMetaType<QSharedPointer<char> >();
440 #ifndef QT_NO_NETWORKPROXY
441 delete d_func()->proxyFactory;
454 #ifndef QT_NO_NETWORKPROXY
464 return d_func()->proxy;
484 delete d->proxyFactory;
486 d->proxyFactory =
nullptr;
503 return d_func()->proxyFactory;
538 delete d->proxyFactory;
554 return d->networkCache;
576 if (
d->networkCache !=
cache) {
577 delete d->networkCache;
580 d->networkCache->setParent(
this);
595 d->createCookieJar();
631 d->cookieJarCreated =
true;
633 if (
d->cookieJar &&
d->cookieJar->parent() ==
this)
637 d->cookieJar->setParent(
this);
673 return d->stsEnabled;
698 #if QT_CONFIG(settings)
701 d->stsCache.setStore(
d->stsStore.data());
705 qWarning(
"HSTS permanent store requires the feature 'settings' enabled");
720 #if QT_CONFIG(settings)
722 return bool(
d->stsStore.data());
751 d->stsCache.updateFromPolicies(knownHosts);
766 return d->stsCache.policies();
831 #if QT_CONFIG(http) || defined(Q_OS_WASM)
1050 return d->redirectPolicy;
1098 #if QT_CONFIG(http) || defined(Q_OS_WASM)
1147 #if QT_CONFIG(http) || defined (Q_OS_WASM)
1148 if (!req.transferTimeout())
1187 priv->
backend->setManagerPrivate(this->d_func());
1189 priv->
backend->setReplyPrivate(priv);
1190 priv->
setup(
op, req, outgoingData);
1225 constexpr char16_t httpSchemes[][17] = {
1230 u"preconnect-https",
1247 if (stsUrl.
port() == 80)
1272 priv->
backend->setReplyPrivate(priv);
1300 schemes.removeDuplicates();
1377 return d_func()->autoDeleteReplies;
1396 d_func()->autoDeleteReplies = shouldAutoDelete;
1409 return d_func()->transferTimeout;
1431 d_func()->transferTimeout =
timeout;
1471 emit q->preSharedKeyAuthenticationRequired(
reply, authenticator);
1484 q->connect(
reply, &QNetworkReply::encrypted,
reply,
1507 QUrl *urlForLastAuthentication,
1508 bool allowAuthenticationReuse)
1515 if (allowAuthenticationReuse && (urlForLastAuthentication->
isEmpty()
1516 ||
url != *urlForLastAuthentication)) {
1523 *urlForLastAuthentication =
url;
1533 *urlForLastAuthentication =
url;
1543 *urlForLastAuthentication =
url;
1544 emit q->authenticationRequired(
reply, authenticator);
1545 if (allowAuthenticationReuse)
1549 #ifndef QT_NO_NETWORKPROXY
1558 if (
proxy != *lastProxyAuthentication && (!priv || !priv->
hasFailed)) {
1567 #if defined(Q_OS_MACOS)
1577 authenticator->
setUser(username);
1592 *lastProxyAuthentication =
proxy;
1593 emit q->proxyAuthenticationRequired(
proxy, authenticator);
1603 qWarning(
"QNetworkAccessManager: factory %p has returned an empty result set",
1620 manager->d_func()->authenticationManager->clearCache();
1625 manager->d_func()->objectCache.clear();
1626 manager->d_func()->destroyThread();
1659 #if QT_CONFIG(http) || defined(Q_OS_WASM)
1671 switch (
multiPart->d_func()->contentType) {
1697 if (!
device->isReadable()) {
1700 qWarning(
"could not open device for reading");
1702 qWarning(
"device is not readable");
1718 std::unique_lock locker(
mutex);
1721 #if QT_CONFIG(library)
1725 while (loader->instance(
index))
1731 #include "moc_qnetworkaccessmanager.cpp"
small capitals from c petite p scientific f u
The QAbstractNetworkCache class provides the interface for cache implementations.
The QAuthenticator class provides an authentication object.
void setPassword(const QString &password)
void setUser(const QString &user)
static QAuthenticatorPrivate * getPrivate(QAuthenticator &auth)
The QBuffer class provides a QIODevice interface for a QByteArray.
void setData(const QByteArray &data)
The QByteArray class provides an array of bytes.
const char * constData() const noexcept
qsizetype length() const noexcept
qsizetype count(char c) const
The QDeadlineTimer class marks a deadline in the future.
The QHttpMultiPart class resembles a MIME multipart message to be sent over HTTP.
QByteArray boundary() const
The QIODevice class is the base interface class of all I/O devices in Qt.
virtual qint64 size() const
virtual bool isSequential() const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
bool isEmpty() const noexcept
The QMutex class provides access serialization between threads.
The QNetworkAccessManager class allows the application to send network requests and receive replies.
friend class QNetworkReplyHttpImpl
void setCookieJar(QNetworkCookieJar *cookieJar)
QNetworkReply * put(const QNetworkRequest &request, QIODevice *data)
void connectToHost(const QString &hostName, quint16 port=80)
QNetworkReply * head(const QNetworkRequest &request)
bool isStrictTransportSecurityStoreEnabled() const
QList< QHstsPolicy > strictTransportSecurityHosts() const
virtual QStringList supportedSchemes() const
QNetworkRequest::RedirectPolicy redirectPolicy() const
QNetworkReply * post(const QNetworkRequest &request, QIODevice *data)
void setProxy(const QNetworkProxy &proxy)
QStringList supportedSchemesImplementation() const
void setAutoDeleteReplies(bool autoDelete)
bool isStrictTransportSecurityEnabled() const
QNetworkReply * get(const QNetworkRequest &request)
void setRedirectPolicy(QNetworkRequest::RedirectPolicy policy)
QNetworkReply * sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data=nullptr)
QNetworkProxy proxy() const
virtual QNetworkReply * createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData=nullptr)
void setStrictTransportSecurityEnabled(bool enabled)
void clearConnectionCache()
QAbstractNetworkCache * cache() const
friend class QNetworkReplyFileImpl
int transferTimeout() const
void addStrictTransportSecurityHosts(const QList< QHstsPolicy > &knownHosts)
void setTransferTimeout(int timeout=QNetworkRequest::DefaultTransferTimeoutConstant)
QNetworkReply * deleteResource(const QNetworkRequest &request)
bool autoDeleteReplies() const
void connectToHostEncrypted(const QString &hostName, quint16 port=443, const QSslConfiguration &sslConfiguration=QSslConfiguration::defaultConfiguration())
void setProxyFactory(QNetworkProxyFactory *factory)
QNetworkProxyFactory * proxyFactory() const
void setCache(QAbstractNetworkCache *cache)
QNetworkCookieJar * cookieJar() const
void enableStrictTransportSecurityStore(bool enabled, const QString &storeDir=QString())
QNetworkAccessManager(QObject *parent=nullptr)
QList< QNetworkProxy > queryProxy(const QNetworkProxyQuery &query)
QNetworkReply * postProcess(QNetworkReply *reply)
QNetworkProxyFactory * proxyFactory
void proxyAuthenticationRequired(const QUrl &url, const QNetworkProxy &proxy, bool synchronous, QAuthenticator *authenticator, QNetworkProxy *lastProxyAuthentication)
void _q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator)
void createCookieJar() const
void ensureBackendPluginsLoaded()
void authenticationRequired(QAuthenticator *authenticator, QNetworkReply *reply, bool synchronous, QUrl &url, QUrl *urlForLastAuthentication, bool allowAuthenticationReuse=true)
QNetworkCookieJar * cookieJar
std::shared_ptr< QNetworkAccessAuthenticationManager > authenticationManager
~QNetworkAccessManagerPrivate()
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)
The QNetworkCookieJar class implements a simple jar of QNetworkCookie objects.
The QNetworkProxyFactory class provides fine-grained proxy selection.
virtual QList< QNetworkProxy > queryProxy(const QNetworkProxyQuery &query=QNetworkProxyQuery())=0
static QList< QNetworkProxy > proxyForQuery(const QNetworkProxyQuery &query)
The QNetworkProxy class provides a network layer proxy.
QNetworkProxy::ProxyType type() const
The QNetworkProxyQuery class is used to query the proxy settings for a socket.
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
QNetworkRequest request() const
QNetworkAccessBackend * backend
void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
QPointer< QNetworkAccessManager > manager
static void setManager(QNetworkReply *reply, QNetworkAccessManager *manager)
void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
void setSslConfiguration(const QSslConfiguration &configuration)
@ CookieLoadControlAttribute
@ AutoDeleteReplyOnFinishAttribute
@ CacheLoadControlAttribute
@ RedirectPolicyAttribute
void setHeader(KnownHeaders header, const QVariant &value)
void setAttribute(Attribute code, const QVariant &value)
QVariant attribute(Attribute code, const QVariant &defaultValue=QVariant()) const
@ NoLessSafeRedirectPolicy
QVariant header(KnownHeaders header) const
void setRawHeader(const QByteArray &headerName, const QByteArray &value)
void setPeerVerifyName(const QString &peerName)
bool hasRawHeader(const QByteArray &headerName) const
void setUrl(const QUrl &url)
QSslConfiguration sslConfiguration() const
The QObject class is the base class of all Qt objects.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
void setParent(QObject *parent)
void setObjectName(const QString &name)
The QSslConfiguration class holds the configuration and state of an SSL connection.
QList< QByteArray > allowedNextProtocols() const
static const char ALPNProtocolHTTP2[]
static QSslConfiguration defaultConfiguration()
The QSslPreSharedKeyAuthenticator class provides authentication data for pre shared keys (PSK) cipher...
static bool supportsSsl()
The QString class provides a Unicode character string.
void reserve(qsizetype size)
static QString fromUtf8(QByteArrayView utf8)
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QByteArray toUtf8() const &
The QStringList class provides a list of strings.
void start(Priority=InheritPriority)
bool wait(QDeadlineTimer deadline=QDeadlineTimer(QDeadlineTimer::Forever))
The QUrl class provides a convenient interface for working with URLs.
QString userName(ComponentFormattingOptions options=FullyDecoded) const
QString password(ComponentFormattingOptions=FullyDecoded) const
void setScheme(const QString &scheme)
void setHost(const QString &host, ParsingMode mode=DecodedMode)
int port(int defaultPort=-1) const
The QVariant class acts like a union for the most common Qt data types.
static auto fromValue(const T &value) -> std::enable_if_t< std::is_copy_constructible_v< T >, QVariant >
int toInt(bool *ok=nullptr) const
qDeleteAll(list.begin(), list.end())
QCache< int, Employee > cache
[0]
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if
set set set set set set set macro pixldst1 op
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
#define QNetworkAccessBackendFactory_iid
QT_BEGIN_NAMESPACE Q_APPLICATION_STATIC(QFactoryLoader, loader, QNetworkAccessBackendFactory_iid, QLatin1String("/networkaccess")) static void ensureInitialized()
#define Q_RETURN_ARG(type, data)
GLenum GLuint GLenum GLsizei length
GLbitfield GLuint64 timeout
[4]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLdouble GLdouble GLdouble GLdouble q
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
#define QStringLiteral(str)
QUrl url("http://www.example.com/List of holidays.xml")
[0]
QItemEditorFactory * factory
QNetworkAccessManager manager
QHttpMultiPart * multiPart
[0]
QNetworkRequest request(url)
bool contains(const AT &t) const noexcept
T1_FIELD_DICT_PRIVATE password
const QLatin1String storeDir(".")
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
QDomElement find(const QString &tagName, const QDomElement &e)
XmlOutput::xml_output attr(const QString &name, const QString &value)