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
qhttpthreaddelegate.cpp
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//#define QHTTPTHREADDELEGATE_DEBUG
6
7#include <QThread>
8#include <QTimer>
9#include <QAuthenticator>
10#include <QEventLoop>
11#include <QCryptographicHash>
12
13#include "private/qhttpnetworkreply_p.h"
14#include "private/qnetworkaccesscache_p.h"
15#include "private/qnoncontiguousbytedevice_p.h"
16
18
19using namespace Qt::StringLiterals;
20
21static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url)
22{
24 // we've got an error
25 switch (httpStatusCode) {
26 case 400: // Bad Request
28 break;
29
30 case 401: // Authorization required
32 break;
33
34 case 403: // Access denied
36 break;
37
38 case 404: // Not Found
40 break;
41
42 case 405: // Method Not Allowed
44 break;
45
46 case 407:
48 break;
49
50 case 409: // Resource Conflict
52 break;
53
54 case 410: // Content no longer available
56 break;
57
58 case 418: // I'm a teapot
60 break;
61
62 case 500: // Internal Server Error
64 break;
65
66 case 501: // Server does not support this functionality
68 break;
69
70 case 503: // Service unavailable
72 break;
73
74 default:
75 if (httpStatusCode > 500) {
76 // some kind of server error
78 } else if (httpStatusCode >= 400) {
79 // content error we did not handle above
81 } else {
82 qWarning("QNetworkAccess: got HTTP status code %d which is not expected from url: \"%s\"",
83 httpStatusCode, qPrintable(url.toString()));
85 }
86 }
87
88 return code;
89}
90
91
92static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy, const QString &peerVerifyName)
93{
95 QUrl copy = url;
96 QString scheme = copy.scheme();
97 bool isEncrypted = scheme == "https"_L1 || scheme == "preconnect-https"_L1;
98 const bool isLocalSocket = scheme.startsWith("unix"_L1);
99 if (!isLocalSocket)
100 copy.setPort(copy.port(isEncrypted ? 443 : 80));
101 if (scheme == "preconnect-http"_L1)
102 copy.setScheme("http"_L1);
103 else if (scheme == "preconnect-https"_L1)
104 copy.setScheme("https"_L1);
107
108#ifndef QT_NO_NETWORKPROXY
109 if (proxy && proxy->type() != QNetworkProxy::NoProxy) {
110 QUrl key;
111
112 switch (proxy->type()) {
114 key.setScheme("proxy-socks5"_L1);
115 break;
116
119 key.setScheme("proxy-http"_L1);
120 break;
121
122 default:
123 break;
124 }
125
126 if (!key.scheme().isEmpty()) {
127 const QByteArray obfuscatedPassword = QCryptographicHash::hash(proxy->password().toUtf8(),
129 key.setUserName(proxy->user());
130 key.setPassword(QString::fromUtf8(obfuscatedPassword));
131 key.setHost(proxy->hostName());
132 key.setPort(proxy->port());
133 key.setQuery(result);
134 result = key.toString(QUrl::FullyEncoded);
135 }
136 }
137#else
139#endif
140 if (!peerVerifyName.isEmpty())
141 result += u':' + peerVerifyName;
142 return "http-connection:" + std::move(result).toLatin1();
143}
144
147{
148 // Q_OBJECT
149public:
150 QNetworkAccessCachedHttpConnection(quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt, bool isLocalSocket,
152 : QHttpNetworkConnection(connectionCount, hostName, port, encrypt, isLocalSocket, /*parent=*/nullptr, connectionType)
153 {
154 setExpires(true);
155 setShareable(true);
156 }
157
158 virtual void dispose() override
159 {
160#if 0 // sample code; do this right with the API
161 Q_ASSERT(!isWorking());
162#endif
163 delete this;
164 }
165};
166
167
168QThreadStorage<QNetworkAccessCache *> QHttpThreadDelegate::connections;
169
170
172{
173 // It could be that the main thread has asked us to shut down, so we need to delete the HTTP reply
174 if (httpReply) {
175 delete httpReply;
176 }
177
178 // Get the object cache that stores our QHttpNetworkConnection objects
179 // and release the entry for this QHttpNetworkConnection
180 if (connections.hasLocalData() && !cacheKey.isEmpty()) {
181 connections.localData()->releaseEntry(cacheKey);
182 }
183}
184
185
187 QObject(parent)
188 , ssl(false)
189 , downloadBufferMaximumSize(0)
190 , readBufferMaxSize(0)
191 , bytesEmitted(0)
192 , pendingDownloadData()
193 , pendingDownloadProgress()
194 , synchronous(false)
195 , connectionCacheExpiryTimeoutSeconds(-1)
196 , incomingStatusCode(0)
197 , isPipeliningUsed(false)
198 , isHttp2Used(false)
199 , incomingContentLength(-1)
200 , removedContentLength(-1)
201 , incomingErrorCode(QNetworkReply::NoError)
202 , downloadBuffer()
203 , httpConnection(nullptr)
204 , httpReply(nullptr)
205 , synchronousRequestLoop(nullptr)
206{
207}
208
209// This is invoked as BlockingQueuedConnection from QNetworkAccessHttpBackend in the user thread
211{
212#ifdef QHTTPTHREADDELEGATE_DEBUG
213 qDebug() << "QHttpThreadDelegate::startRequestSynchronously() thread=" << QThread::currentThreadId();
214#endif
215 synchronous = true;
216
218 this->synchronousRequestLoop = &synchronousRequestLoop;
219
220 // Worst case timeout
221 QTimer::singleShot(30*1000, this, SLOT(abortRequest()));
222
223 QMetaObject::invokeMethod(this, "startRequest", Qt::QueuedConnection);
225
226 connections.localData()->releaseEntry(cacheKey);
227 connections.setLocalData(nullptr);
228
229#ifdef QHTTPTHREADDELEGATE_DEBUG
230 qDebug() << "QHttpThreadDelegate::startRequestSynchronously() thread=" << QThread::currentThreadId() << "finished";
231#endif
232}
233
234
235// This is invoked as QueuedConnection from QNetworkAccessHttpBackend in the user thread
237{
238#ifdef QHTTPTHREADDELEGATE_DEBUG
239 qDebug() << "QHttpThreadDelegate::startRequest() thread=" << QThread::currentThreadId();
240#endif
241 // Check QThreadStorage for the QNetworkAccessCache
242 // If not there, create this connection cache
243 if (!connections.hasLocalData()) {
244 connections.setLocalData(new QNetworkAccessCache());
245 }
246
247 // check if we have an open connection to this host
248 QUrl urlCopy = httpRequest.url();
249 const bool isLocalSocket = urlCopy.scheme().startsWith("unix"_L1);
250 if (!isLocalSocket)
251 urlCopy.setPort(urlCopy.port(ssl ? 443 : 80));
252
259 }
260
261 // Use HTTP/1.1 if h2c is not allowed and we would otherwise choose to use it
262 if (!ssl && connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2
265 }
266
267#if QT_CONFIG(ssl)
268 // See qnetworkreplyhttpimpl, delegate's initialization code.
270#endif // QT_CONFIG(ssl)
271
272 const bool isH2 = httpRequest.isHTTP2Allowed() || httpRequest.isHTTP2Direct();
273 if (isH2) {
274#if QT_CONFIG(ssl)
275 if (ssl) {
276 if (!httpRequest.isHTTP2Direct()) {
277 QList<QByteArray> protocols;
281 }
282 urlCopy.setScheme(QStringLiteral("h2s"));
283 } else
284#endif // QT_CONFIG(ssl)
285 {
286 if (isLocalSocket)
287 urlCopy.setScheme(QStringLiteral("unix+h2"));
288 else
289 urlCopy.setScheme(QStringLiteral("h2"));
290 }
291 }
292
293#ifndef QT_NO_NETWORKPROXY
298 else
299#endif
300 cacheKey = makeCacheKey(urlCopy, nullptr, httpRequest.peerVerifyName());
301
302 // the http object is actually a QHttpNetworkConnection
303 httpConnection = static_cast<QNetworkAccessCachedHttpConnection *>(connections.localData()->requestEntryNow(cacheKey));
304 if (!httpConnection) {
305 // no entry in cache; create an object
306 // the http object is actually a QHttpNetworkConnection
308 http1Parameters.numberOfConnectionsPerHost(), urlCopy.host(), urlCopy.port(), ssl,
309 isLocalSocket, connectionType);
313 }
314#ifndef QT_NO_SSL
315 // Set the QSslConfiguration from this QNetworkRequest.
316 if (ssl)
318#endif
319
320#ifndef QT_NO_NETWORKPROXY
323#endif
325 // cache the QHttpNetworkConnection corresponding to this cache key
327 } else {
329 QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), nullptr);
330 if (!credential.user.isEmpty() && !credential.password.isEmpty()) {
331 QAuthenticator auth;
332 auth.setUser(credential.user);
333 auth.setPassword(credential.password);
334 httpConnection->d_func()->copyCredentials(-1, &auth, false);
335 }
336 }
337 }
338
339 // Send the request to the connection
341 httpReply->setParent(this);
342
343 // Connect the reply signals that we need to handle and then forward
344 if (synchronous) {
345 connect(httpReply,SIGNAL(headerChanged()), this, SLOT(synchronousHeaderChangedSlot()));
346 connect(httpReply,SIGNAL(finished()), this, SLOT(synchronousFinishedSlot()));
349
352#ifndef QT_NO_NETWORKPROXY
355#endif
356
357 // Don't care about ignored SSL errors for now in the synchronous HTTP case.
358 } else if (!synchronous) {
361 connect(httpReply,SIGNAL(headerChanged()), this, SLOT(headerChangedSlot()));
362 connect(httpReply,SIGNAL(finished()), this, SLOT(finishedSlot()));
365 // some signals are only interesting when normal asynchronous style is used
366 connect(httpReply,SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
368#ifndef QT_NO_SSL
370 connect(httpReply,SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrorsSlot(QList<QSslError>)));
373#endif
374
375 // In the asynchronous HTTP case we can just forward those signals
376 // Connect the reply signals that we can directly forward
379#ifndef QT_NO_NETWORKPROXY
382#endif
383 }
384
388 if (synchronous)
390 else
392 }
393}
394
395// This gets called from the user thread or by the synchronous HTTP timeout timer
397{
398#ifdef QHTTPTHREADDELEGATE_DEBUG
399 qDebug() << "QHttpThreadDelegate::abortRequest() thread=" << QThread::currentThreadId() << "sync=" << synchronous;
400#endif
401 if (httpReply) {
402 httpReply->abort();
403 delete httpReply;
404 httpReply = nullptr;
405 }
406
407 // Got aborted by the timeout timer
408 if (synchronous) {
411 } else {
412 //only delete this for asynchronous mode or QNetworkAccessHttpBackend will crash - see QNetworkAccessHttpBackend::postRequest()
413 this->deleteLater();
414 }
415}
416
418{
419#ifdef QHTTPTHREADDELEGATE_DEBUG
420 qDebug() << "QHttpThreadDelegate::readBufferSizeChanged() size " << size;
421#endif
422 if (httpReply) {
426 }
427}
428
437
439{
440 if (!httpReply)
441 return;
442
443 // Don't do in zerocopy case
444 if (!downloadBuffer.isNull())
445 return;
446
447 if (readBufferMaxSize) {
449 qint64 sizeEmitted = 0;
450 while (httpReply->readAnyAvailable() && (sizeEmitted < (readBufferMaxSize-bytesEmitted))) {
452 sizeEmitted = readBufferMaxSize-bytesEmitted;
453 bytesEmitted += sizeEmitted;
454 pendingDownloadData->fetchAndAddRelease(1);
455 emit downloadData(httpReply->read(sizeEmitted));
456 } else {
457 sizeEmitted = httpReply->sizeNextBlock();
458 bytesEmitted += sizeEmitted;
459 pendingDownloadData->fetchAndAddRelease(1);
461 }
462 }
463 } else {
464 // We need to wait until we empty data from the read buffer in the reply.
465 }
466
467 } else {
468 while (httpReply->readAnyAvailable()) {
469 pendingDownloadData->fetchAndAddRelease(1);
471 }
472 }
473}
474
476{
477 if (!httpReply)
478 return;
479
480#ifdef QHTTPTHREADDELEGATE_DEBUG
481 qDebug() << "QHttpThreadDelegate::finishedSlot() thread=" << QThread::currentThreadId() << "result=" << httpReply->statusCode();
482#endif
483
484 // If there is still some data left emit that now
485 while (httpReply->readAnyAvailable()) {
486 pendingDownloadData->fetchAndAddRelease(1);
488 }
489
490#ifndef QT_NO_SSL
491 if (ssl)
493#endif
494
495 if (httpReply->statusCode() >= 400) {
496 // it's an error reply
497 QString msg = QLatin1StringView(QT_TRANSLATE_NOOP("QNetworkReply",
498 "Error transferring %1 - server replied: %2"));
501 }
502
505
507
510 httpReply = nullptr;
511}
512
514{
515 if (!httpReply)
516 return;
517
518#ifdef QHTTPTHREADDELEGATE_DEBUG
519 qDebug() << "QHttpThreadDelegate::synchronousFinishedSlot() thread=" << QThread::currentThreadId() << "result=" << httpReply->statusCode();
520#endif
521 if (httpReply->statusCode() >= 400) {
522 // it's an error reply
523 QString msg = QLatin1StringView(QT_TRANSLATE_NOOP("QNetworkReply",
524 "Error transferring %1 - server replied: %2"));
527 }
528
531
534 httpReply = nullptr;
535}
536
538{
539 if (!httpReply)
540 return;
541
542#ifdef QHTTPTHREADDELEGATE_DEBUG
543 qDebug() << "QHttpThreadDelegate::finishedWithErrorSlot() thread=" << QThread::currentThreadId() << "error=" << errorCode << detail;
544#endif
545
546#ifndef QT_NO_SSL
547 if (ssl)
549#endif
550 emit error(errorCode,detail);
552
553
556 httpReply = nullptr;
557}
558
559
561{
562 if (!httpReply)
563 return;
564
565#ifdef QHTTPTHREADDELEGATE_DEBUG
566 qDebug() << "QHttpThreadDelegate::synchronousFinishedWithErrorSlot() thread=" << QThread::currentThreadId() << "error=" << errorCode << detail;
567#endif
568 incomingErrorCode = errorCode;
570
572
575 httpReply = nullptr;
576}
577
579{
580 if (!httpReply)
581 return;
582
583#ifdef QHTTPTHREADDELEGATE_DEBUG
584 qDebug() << "QHttpThreadDelegate::headerChangedSlot() thread=" << QThread::currentThreadId();
585#endif
586
587#ifndef QT_NO_SSL
588 if (ssl)
590#endif
591
592 // Is using a zerocopy buffer allowed by user and possible with this reply?
595 char *buf = new (std::nothrow) char[httpReply->contentLength()];
596 // in out of memory situations, don't use downloadBuffer.
597 if (buf) {
598 downloadBuffer = QSharedPointer<char>(buf, [](auto p) { delete[] p; });
600 }
601 }
602
603 // We fetch this into our own
612
622}
623
625{
626 if (!httpReply)
627 return;
628
629#ifdef QHTTPTHREADDELEGATE_DEBUG
630 qDebug() << "QHttpThreadDelegate::synchronousHeaderChangedSlot() thread=" << QThread::currentThreadId();
631#endif
632 // Store the information we need in this object, the QNetworkAccessHttpBackend will later read it
639}
640
641
643{
644 // If we don't have a download buffer don't attempt to go this codepath
645 // It is not used by QNetworkAccessHttpBackend
647 return;
648
649 pendingDownloadProgress->fetchAndAddRelease(1);
650 emit downloadProgress(done, total);
651}
652
654{
655 authenticationManager->cacheCredentials(request.url(), authenticator);
656}
657
658
659#ifndef QT_NO_SSL
668
669void QHttpThreadDelegate::sslErrorsSlot(const QList<QSslError> &errors)
670{
671 if (!httpReply)
672 return;
673
675
676 bool ignoreAll = false;
677 QList<QSslError> specificErrors;
678 emit sslErrors(errors, &ignoreAll, &specificErrors);
679 if (ignoreAll)
681 if (!specificErrors.isEmpty())
682 httpReply->ignoreSslErrors(specificErrors);
683}
684
692#endif
693
695{
696 if (!httpReply)
697 return;
698
700#ifdef QHTTPTHREADDELEGATE_DEBUG
701 qDebug() << "QHttpThreadDelegate::synchronousAuthenticationRequiredSlot() thread=" << QThread::currentThreadId();
702#endif
703
704 // Ask the credential cache
705 QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), a);
706 if (!credential.isNull()) {
707 a->setUser(credential.user);
708 a->setPassword(credential.password);
709 }
710
711 // Disconnect this connection now since we only want to ask the authentication cache once.
714}
715
716#ifndef QT_NO_NETWORKPROXY
718{
719 if (!httpReply)
720 return;
721
722#ifdef QHTTPTHREADDELEGATE_DEBUG
723 qDebug() << "QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot() thread=" << QThread::currentThreadId();
724#endif
725 // Ask the credential cache
726 QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedProxyCredentials(p, a);
727 if (!credential.isNull()) {
728 a->setUser(credential.user);
729 a->setPassword(credential.password);
730 }
731
732#ifndef QT_NO_NETWORKPROXY
733 // Disconnect this connection now since we only want to ask the authentication cache once.
736#endif
737}
738
739#endif
740
742
743#include "moc_qhttpthreaddelegate_p.cpp"
The QAuthenticator class provides an authentication object.
void setUser(const QString &user)
Sets the user used for authentication.
\inmodule QtCore
Definition qbytearray.h:57
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
Definition qbytearray.h:107
static QByteArray hash(QByteArrayView data, Algorithm method)
Returns the hash of data using method.
\inmodule QtCore
Definition qeventloop.h:16
int exec(ProcessEventsFlags flags=AllEvents)
Enters the main event loop and waits until exit() is called.
Q_NETWORK_EXPORT qsizetype numberOfConnectionsPerHost() const
Returns the number of connections used per http(s) {host}:{port} combination.
QHttpNetworkReply * sendRequest(const QHttpNetworkRequest &request)
void setCacheProxy(const QNetworkProxy &networkProxy)
void setPeerVerifyName(const QString &peerName)
ConnectionType connectionType() const
void setTransparentProxy(const QNetworkProxy &networkProxy)
void setHttp2Parameters(const QHttp2Configuration &params)
void setSslConfiguration(const QSslConfiguration &config)
QHttpHeaders header() const override
QString errorString() const
bool readAnyAvailable() const
qint64 removedContentLength() const
QByteArray read(qint64 amount)
bool isPipeliningUsed() const
void setUserProvidedDownloadBuffer(char *)
void setReadBufferSize(qint64 size)
QNetworkReply::NetworkError errorCode() const
bool supportsUserProvidedDownloadBuffer()
void setDownstreamLimited(bool t)
QString reasonPhrase() const
qint64 contentLength() const override
QSslConfiguration sslConfiguration() const
QHttpNetworkRequest request() const
QUrl url() const override
void cacheCredentialsSlot(const QHttpNetworkRequest &request, QAuthenticator *authenticator)
QSharedPointer< char > downloadBuffer
QHttpNetworkReply * httpReply
void readBufferSizeChanged(qint64 size)
void synchronousAuthenticationRequiredSlot(const QHttpNetworkRequest &request, QAuthenticator *)
void synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail=QString())
void socketStartedConnecting()
QScopedPointer< QSslConfiguration > incomingSslConfiguration
std::shared_ptr< QAtomicInt > pendingDownloadData
void sslErrorsSlot(const QList< QSslError > &errors)
QNetworkAccessCachedHttpConnection * httpConnection
void redirected(const QUrl &url, int httpStatus, int maxRedirectsRemainig)
void downloadMetaData(const QHttpHeaders &, int, const QString &, bool, QSharedPointer< char >, qint64, qint64, bool, bool)
void downloadProgress(qint64, qint64)
QHttpNetworkRequest httpRequest
void preSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator *authenticator)
QHttp1Configuration http1Parameters
QHttpThreadDelegate(QObject *parent=nullptr)
void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)
void sslErrors(const QList< QSslError > &, bool *, QList< QSslError > *)
void synchronousProxyAuthenticationRequiredSlot(const QNetworkProxy &, QAuthenticator *)
void finishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail=QString())
void authenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *)
void readBufferFreed(qint64 size)
QHttp2Configuration http2Parameters
static QThreadStorage< QNetworkAccessCache * > connections
std::shared_ptr< QAtomicInt > pendingDownloadProgress
QNetworkReply::NetworkError incomingErrorCode
void downloadData(const QByteArray &)
std::shared_ptr< QNetworkAccessAuthenticationManager > authenticationManager
void dataReadProgressSlot(qint64 done, qint64 total)
void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *)
void sslConfigurationChanged(const QSslConfiguration &)
QNetworkAccessCachedHttpConnection(quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt, bool isLocalSocket, QHttpNetworkConnection::ConnectionType connectionType)
The QNetworkProxy class provides a network layer proxy.
QString user() const
Returns the user name used for authentication.
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
QString password() const
Returns the password used for authentication.
QString hostName() const
Returns the host name of the proxy host.
quint16 port() const
Returns the port of the proxy host.
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
NetworkError
Indicates all possible error conditions found during the processing of the request.
@ ContentOperationNotPermittedError
@ OperationNotImplementedError
@ ProtocolInvalidOperationError
@ ProxyAuthenticationRequiredError
@ AuthenticationRequiredError
QUrl url() const
Returns the URL this network request is referring to.
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
void setParent(QObject *parent)
Makes the object a child of parent.
Definition qobject.cpp:2195
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3236
void deleteLater()
\threadsafe
Definition qobject.cpp:2435
T * data() const noexcept
Returns the value of the pointer referenced by this object.
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
static const char ALPNProtocolHTTP2[]
void setAllowedNextProtocols(const QList< QByteArray > &protocols)
static const char NextProtocolHttp1_1[]
The QSslPreSharedKeyAuthenticator class provides authentication data for pre shared keys (PSK) cipher...
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QByteArray toLatin1() const &
Definition qstring.h:630
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition qstring.cpp:5455
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:6018
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Definition qstring.cpp:8870
QByteArray toUtf8() const &
Definition qstring.h:634
static Qt::HANDLE currentThreadId() noexcept Q_DECL_PURE_FUNCTION
Definition qthread.h:149
bool singleShot
whether the timer is a single-shot timer
Definition qtimer.h:22
\inmodule QtCore
Definition qurl.h:94
QString scheme() const
Returns the scheme of the URL.
Definition qurl.cpp:1991
@ RemoveFragment
Definition qurl.h:112
@ RemoveQuery
Definition qurl.h:111
@ RemovePath
Definition qurl.h:110
@ RemoveUserInfo
Definition qurl.h:107
@ FullyEncoded
Definition qurl.h:129
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
Definition qurl.cpp:2831
Combined button and popup list for selecting options.
@ QueuedConnection
static jboolean copy(JNIEnv *, jobject)
DBusConnection const char DBusError * error
EGLOutputPortEXT port
static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url)
static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy, const QString &peerVerifyName)
#define qDebug
[1]
Definition qlogging.h:164
#define qWarning
Definition qlogging.h:166
static bool isEncrypted(const my_mach_header *header)
#define SLOT(a)
Definition qobjectdefs.h:52
#define SIGNAL(a)
Definition qobjectdefs.h:53
GLuint64 key
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define qPrintable(string)
Definition qstring.h:1531
#define QStringLiteral(str)
@ NoError
Definition main.cpp:34
static bool ignoreAll
#define emit
#define Q_UNUSED(x)
#define QT_TRANSLATE_NOOP(scope, x)
unsigned short quint16
Definition qtypes.h:48
long long qint64
Definition qtypes.h:60
QUrl url("example.com")
[constructor-url-reference]
QObject::connect nullptr
QNetworkRequest request(url)
QNetworkProxy proxy
[0]
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(nullptr), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
\threadsafe This is an overloaded member function, provided for convenience. It differs from the abov...