Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qnetworkreplyimpl.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
6#include "qnetworkcookie.h"
7#include "qnetworkcookiejar.h"
9#include "QtCore/qcoreapplication.h"
10#include "QtCore/qdatetime.h"
11#include "QtNetwork/qsslconfiguration.h"
13
14#include <QtCore/QCoreApplication>
15
17
19
21 : backend(nullptr), outgoingData(nullptr),
22 copyDevice(nullptr),
23 cacheEnabled(false), cacheSaveDevice(nullptr),
24 notificationHandlingPaused(false),
25 bytesDownloaded(0), bytesUploaded(-1),
26 httpStatusCode(0),
27 state(Idle)
28 , downloadBufferReadPosition(0)
29 , downloadBufferCurrentSize(0)
30 , downloadBufferMaximumSize(0)
31 , downloadBuffer(nullptr)
32{
34 emitAllUploadProgressSignals = true;
35}
36
38{
39 // ensure this function is only being called once
40 if (state == Working || state == Finished) {
41 qDebug() << "QNetworkReplyImpl::_q_startOperation was called more than once" << url;
42 return;
43 }
44 state = Working;
45
46 // note: if that method is called directly, it cannot happen that the backend is 0,
47 // because we just checked via a qobject_cast that we got a http backend (see
48 // QNetworkReplyImplPrivate::setup())
49 if (!backend) {
51 QCoreApplication::translate("QNetworkReply", "Protocol \"%1\" is unknown").arg(url.scheme())); // not really true!;
52 finished();
53 return;
54 }
55
56 if (!backend->start()) {
57 qWarning("Backend start failed");
58 state = Working;
60 QCoreApplication::translate("QNetworkReply", "backend start error."));
61 finished();
62 return;
63 }
64
65 // Prepare timer for progress notifications
68
69 if (backend && backend->isSynchronous()) {
71 q_func()->setFinished(true);
72 } else {
73 if (state != Finished) {
76
78 }
79 }
80}
81
83{
85 if (state != Working)
86 return;
87 if (!copyDevice || !q->isOpen())
88 return;
89
90 // FIXME Optimize to use download buffer if it is a QBuffer.
91 // Needs to be done where sendCacheContents() (?) of HTTP is emitting
92 // metaDataChanged ?
93 qint64 lastBytesDownloaded = bytesDownloaded;
94 forever {
95 qint64 bytesToRead = nextDownstreamBlockSize();
96 if (bytesToRead == 0)
97 // we'll be called again, eventually
98 break;
99
100 bytesToRead = qBound<qint64>(1, bytesToRead, copyDevice->bytesAvailable());
101 qint64 bytesActuallyRead = copyDevice->read(buffer.reserve(bytesToRead), bytesToRead);
102 if (bytesActuallyRead == -1) {
103 buffer.chop(bytesToRead);
104 break;
105 }
106 buffer.chop(bytesToRead - bytesActuallyRead);
107
108 if (!copyDevice->isSequential() && copyDevice->atEnd()) {
109 bytesDownloaded += bytesActuallyRead;
110 break;
111 }
112
113 bytesDownloaded += bytesActuallyRead;
114 }
115
116 if (bytesDownloaded == lastBytesDownloaded) {
117 // we didn't read anything
118 return;
119 }
120
123 // emit readyRead before downloadProgress in case this will cause events to be
124 // processed and we get into a recursive call (as in QProgressDialog).
125 emit q->readyRead();
128 emit q->downloadProgress(bytesDownloaded,
129 totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
130 }
132}
133
135{
137}
138
140{
142
143 // make sure this is only called once, ever.
144 //_q_bufferOutgoingData may call it or the readChannelFinished emission
145 if (state != Buffering)
146 return;
147
148 // disconnect signals
151
152 // finally, start the request
153 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
154}
155
157{
159
160 if (!outgoingDataBuffer) {
161 // first call, create our buffer
162 outgoingDataBuffer = std::make_shared<QRingBuffer>();
163
166 }
167
168 qint64 bytesBuffered = 0;
169 qint64 bytesToBuffer = 0;
170
171 // read data into our buffer
172 forever {
173 bytesToBuffer = outgoingData->bytesAvailable();
174 // unknown? just try 2 kB, this also ensures we always try to read the EOF
175 if (bytesToBuffer <= 0)
176 bytesToBuffer = 2*1024;
177
178 char *dst = outgoingDataBuffer->reserve(bytesToBuffer);
179 bytesBuffered = outgoingData->read(dst, bytesToBuffer);
180
181 if (bytesBuffered == -1) {
182 // EOF has been reached.
183 outgoingDataBuffer->chop(bytesToBuffer);
184
186 break;
187 } else if (bytesBuffered == 0) {
188 // nothing read right now, just wait until we get called again
189 outgoingDataBuffer->chop(bytesToBuffer);
190
191 break;
192 } else {
193 // don't break, try to read() again
194 outgoingDataBuffer->chop(bytesToBuffer - bytesBuffered);
195 }
196 }
197}
198
201{
203
205 request = req;
206 originalRequest = req;
207 url = request.url();
208 operation = op;
209
210 q->QIODevice::open(QIODevice::ReadOnly);
211 // Internal code that does a HTTP reply for the synchronous Ajax
212 // in Qt WebKit.
213 QVariant synchronousHttpAttribute = req.attribute(
215 // The synchronous HTTP is a corner case, we will put all upload data in one big QByteArray in the outgoingDataBuffer.
216 // Yes, this is not the most efficient thing to do, but on the other hand synchronous XHR needs to die anyway.
217 if (synchronousHttpAttribute.toBool() && outgoingData) {
218 outgoingDataBuffer = std::make_shared<QRingBuffer>();
219 qint64 previousDataSize = 0;
220 do {
221 previousDataSize = outgoingDataBuffer->size();
223 } while (outgoingDataBuffer->size() != previousDataSize);
224 }
225
226 if (backend)
227 backend->setSynchronous(synchronousHttpAttribute.toBool());
228
229
230 if (outgoingData && backend && !backend->isSynchronous()) {
231 // there is data to be uploaded, e.g. HTTP POST.
232
234 // backend does not need upload buffering or
235 // fixed size non-sequential
236 // just start the operation
237 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
238 } else {
239 bool bufferingDisallowed =
241 false).toBool();
242
243 if (bufferingDisallowed) {
244 // if a valid content-length header for the request was supplied, we can disable buffering
245 // if not, we will buffer anyway
247 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
248 } else {
250 QMetaObject::invokeMethod(q, "_q_bufferOutgoingData", Qt::QueuedConnection);
251 }
252 } else {
253 // _q_startOperation will be called when the buffering has finished.
255 QMetaObject::invokeMethod(q, "_q_bufferOutgoingData", Qt::QueuedConnection);
256 }
257 }
258 } else {
259 // for HTTP, we want to send out the request as fast as possible to the network, without
260 // invoking methods in a QueuedConnection
261 if (backend && backend->isSynchronous())
263 else
264 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
265 }
266}
267
269{
271 const auto it = std::find(pendingNotifications.cbegin(), pendingNotifications.cend(), notification);
272 if (it == pendingNotifications.cend())
273 pendingNotifications.push_back(notification);
274
275 if (pendingNotifications.size() == 1)
277}
278
280{
282 return;
283
284 for (InternalNotifications notification : std::exchange(pendingNotifications, {})) {
285 if (state != Working)
286 return;
287 switch (notification) {
289 if (copyDevice) {
291 } else if (backend) {
292 if (backend->bytesAvailable() > 0)
294 else if (backend->wantToRead())
296 }
297 break;
298 }
299 }
300}
301
302// Do not handle the notifications while we are emitting downloadProgress
303// or readyRead
305{
307}
308
309// Resume notification handling
311{
314 if (pendingNotifications.size() >= 1)
316}
317
319{
320 if (!backend)
321 return nullptr;
322 return backend->networkCache();
323}
324
326{
327 // check if we can save and if we're allowed to
328 if (!networkCache()
330 return;
331 cacheEnabled = true;
332}
333
335{
336 return (cacheEnabled && networkCache() != nullptr);
337}
338
340{
341 if (!enable && !cacheEnabled)
342 return; // nothing to do
343 if (enable && cacheEnabled)
344 return; // nothing to do either!
345
346 if (enable) {
348 // refuse to enable in this case
349 qCritical("QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written");
350 return;
351 }
352
353 createCache();
354 } else {
355 // someone told us to turn on, then back off?
356 // ok... but you should make up your mind
357 qDebug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false) -- "
358 "backend %s probably needs to be fixed",
359 backend->metaObject()->className());
361 cacheSaveDevice = nullptr;
362 cacheEnabled = false;
363 }
364}
365
367{
370 } else if (cacheEnabled && cacheSaveDevice) {
372 }
373 cacheSaveDevice = nullptr;
374 cacheEnabled = false;
375}
376
378{
380 bytesUploaded = bytesSent;
381
383 //choke signal emissions, except the first and last signals which are unconditional
385 if (bytesSent != bytesTotal && uploadProgressSignalChoke.elapsed() < progressSignalInterval) {
386 return;
387 }
389 } else {
391 }
392 }
393
395 emit q->uploadProgress(bytesSent, bytesTotal);
397}
398
399
401{
402 enum { DesiredBufferSize = 32 * 1024 };
403 if (readBufferMaxSize == 0)
404 return DesiredBufferSize;
405
406 return qMax<qint64>(0, readBufferMaxSize - buffer.size());
407}
408
410{
412
413 // The disk cache does not support partial content, so don't even try to
414 // save any such content into the cache.
415 if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 206) {
416 cacheEnabled = false;
417 return;
418 }
419
420 // save the meta data
421 QNetworkCacheMetaData metaData;
422 metaData.setUrl(url);
423 // @todo @future: fetchCacheMetaData is not currently implemented in any backend, but can be useful again in the future
424 // metaData = backend->fetchCacheMetaData(metaData);
425
426 // save the redirect request also in the cache
427 QVariant redirectionTarget = q->attribute(QNetworkRequest::RedirectionTargetAttribute);
428 if (redirectionTarget.isValid()) {
431 metaData.setAttributes(attributes);
432 }
433
434 cacheSaveDevice = networkCache()->prepare(metaData);
435
438 qCritical("QNetworkReplyImpl: network cache returned a device that is not open -- "
439 "class %s probably needs to be fixed",
441
443 cacheSaveDevice = nullptr;
444 cacheEnabled = false;
445 }
446}
447
448// we received downstream data and send this to the cache
449// and to our buffer (which in turn gets read by the user of QNetworkReply)
451{
453 if (!q->isOpen())
454 return;
455
458 }
459
461 for (qsizetype i = 0; i < data.bufferCount(); ++i) {
462 QByteArray const &item = data[i];
463
464 if (cacheSaveDevice)
465 cacheSaveDevice->write(item.constData(), item.size());
466 buffer.append(item);
467
468 bytesWritten += item.size();
469 }
470 data.clear();
471
473
475}
476
478{
480
483 // important: At the point of this readyRead(), the data parameter list must be empty,
484 // else implicit sharing will trigger memcpy when the user is reading data!
485 emit q->readyRead();
486 // emit readyRead before downloadProgress in case this will cause events to be
487 // processed and we get into a recursive call (as in QProgressDialog).
490 emit q->downloadProgress(bytesDownloaded,
491 totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
492 }
493
495 // do we still have room in the buffer?
496 if (nextDownstreamBlockSize() > 0)
498}
499
500// this is used when it was fetched from the cache, right?
502{
504 if (!q->isOpen())
505 return;
506
507 // read until EOF from data
508 if (Q_UNLIKELY(copyDevice)) {
509 qCritical("QNetworkReplyImpl: copy from QIODevice already in progress -- "
510 "backend probably needs to be fixed");
511 return;
512 }
513
515 q->connect(copyDevice, SIGNAL(readyRead()), SLOT(_q_copyReadyRead()));
516 q->connect(copyDevice, SIGNAL(readChannelFinished()), SLOT(_q_copyReadChannelFinished()));
517
518 // start the copy:
520}
521
523{
525
526 if (!downloadBuffer) {
527 // We are requested to create it
528 // Check attribute() if allocating a buffer of that size can be allowed
530 if (bufferAllocationPolicy.isValid() && bufferAllocationPolicy.toLongLong() >= size) {
533 downloadBuffer = new char[downloadBufferMaximumSize]; // throws if allocation fails
535
537 }
538 }
539
540 return downloadBuffer;
541}
542
544{
546
552}
553
554
556{
558 if (!q->isOpen())
559 return;
560
563
564 if (cacheSaveDevice && bytesReceived == bytesTotal) {
565 // Write everything in one go if we use a download buffer. might be more performant.
567 }
568
569 bytesDownloaded = bytesReceived;
570
571 downloadBufferCurrentSize = bytesReceived;
572
573 // Only emit readyRead when actual data is there
574 // emit readyRead before downloadProgress in case this will cause events to be
575 // processed and we get into a recursive call (as in QProgressDialog).
576 if (bytesDownloaded > 0)
577 emit q->readyRead();
580 emit q->downloadProgress(bytesDownloaded, bytesTotal);
581 }
582}
583
585{
587
588 if (state == Finished || state == Aborted)
589 return;
590
593
595
596 state = Finished;
597 q->setFinished(true);
598
599 pendingNotifications.clear();
600
602 if (totalSize.isNull() || totalSize == -1) {
603 emit q->downloadProgress(bytesDownloaded, bytesDownloaded);
604 } else {
605 emit q->downloadProgress(bytesDownloaded, totalSize.toLongLong());
606 }
607
609 emit q->uploadProgress(0, 0);
611
612 // if we don't know the total size of or we received everything save the cache
613 if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize)
615
616 // note: might not be a good idea, since users could decide to delete us
617 // which would delete the backend too...
618 // maybe we should protect the backend
620 emit q->readChannelFinished();
621 emit q->finished();
623}
624
626{
628 // Can't set and emit multiple errors.
630 qWarning( "QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.");
631 return;
632 }
633
634 errorCode = code;
635 q->setErrorString(errorMessage);
636
637 // note: might not be a good idea, since users could decide to delete us
638 // which would delete the backend too...
639 // maybe we should protect the backend
640 emit q->errorOccurred(code);
641}
642
644{
646 // 1. do we have cookies?
647 // 2. are we allowed to set them?
648 if (!manager.isNull()) {
650 if (it != cookedHeaders.cend()
654 if (jar) {
655 QList<QNetworkCookie> cookies =
656 qvariant_cast<QList<QNetworkCookie> >(it.value());
657 jar->setCookiesFromUrl(cookies, url);
658 }
659 }
660 }
661
662 emit q->metaDataChanged();
663}
664
666{
668}
669
671{
672#ifndef QT_NO_SSL
674 emit q->encrypted();
675#endif
676}
677
679{
680#ifndef QT_NO_SSL
682 emit q->sslErrors(errors);
683#else
684 Q_UNUSED(errors);
685#endif
686}
687
689{
691 if (!backend)
692 return;
693
695 if (backend->bytesAvailable())
696 emit q->readyRead();
697 } else {
698 bool anyBytesRead = false;
699 while (backend->bytesAvailable()
700 && (!readBufferMaxSize || buffer.size() < readBufferMaxSize)) {
702 if (toRead == 0)
703 toRead = 16 * 1024; // try to read something
704 char *data = buffer.reserve(toRead);
705 qint64 bytesRead = backend->read(data, toRead);
706 Q_ASSERT(bytesRead <= toRead);
707 buffer.chop(toRead - bytesRead);
708 anyBytesRead |= bytesRead > 0;
709 }
710 if (anyBytesRead)
711 emit q->readyRead();
712 }
713}
714
717{
718}
719
721{
723
724 // This code removes the data from the cache if it was prematurely aborted.
725 // See QNetworkReplyImplPrivate::completeCacheSave(), we disable caching there after the cache
726 // save had been properly finished. So if it is still enabled it means we got deleted/aborted.
727 if (d->isCachingEnabled())
728 d->networkCache()->remove(url());
729}
730
732{
735 return;
736
737 // stop both upload and download
738 if (d->outgoingData)
739 disconnect(d->outgoingData, nullptr, this, nullptr);
740 if (d->copyDevice)
741 disconnect(d->copyDevice, nullptr, this, nullptr);
742
744
745 // call finished which will emit signals
746 d->error(OperationCanceledError, tr("Operation canceled"));
747 d->finished();
749
750 // finished may access the backend
751 if (d->backend) {
752 d->backend->deleteLater();
753 d->backend = nullptr;
754 }
755}
756
758{
760 if (d->state == QNetworkReplyPrivate::Aborted ||
762 return;
763
764 // stop the download
765 if (d->backend)
766 d->backend->close();
767 if (d->copyDevice)
768 disconnect(d->copyDevice, nullptr, this, nullptr);
769
771
772 // call finished which will emit signals
773 d->error(OperationCanceledError, tr("Operation canceled"));
774 d->finished();
775}
776
783{
784 // Special case for the "zero copy" download buffer
785 Q_D(const QNetworkReplyImpl);
786 if (d->downloadBuffer) {
787 qint64 maxAvail = d->downloadBufferCurrentSize - d->downloadBufferReadPosition;
788 return QNetworkReply::bytesAvailable() + maxAvail;
789 }
790 return QNetworkReply::bytesAvailable() + (d->backend ? d->backend->bytesAvailable() : 0);
791}
792
794{
796 qint64 oldMaxSize = d->readBufferMaxSize;
798 if (size > oldMaxSize && size > d->buffer.size())
799 d->readFromBackend();
800}
801
802#ifndef QT_NO_SSL
803void QNetworkReplyImpl::sslConfigurationImplementation(QSslConfiguration &configuration) const
804{
805 Q_D(const QNetworkReplyImpl);
806 if (d->backend)
807 configuration = d->backend->sslConfiguration();
808}
809
811{
813 if (d->backend && !config.isNull())
814 d->backend->setSslConfiguration(config);
815}
816
818{
820 if (d->backend)
821 d->backend->ignoreSslErrors();
822}
823
825{
827 if (d->backend)
828 d->backend->ignoreSslErrors(errors);
829}
830#endif // QT_NO_SSL
831
836{
838
839 if (d->backend
840 && d->backend->ioFeatures().testFlag(QNetworkAccessBackend::IOFeature::ZeroCopy)) {
841 qint64 bytesRead = 0;
842 while (d->backend->bytesAvailable()) {
843 QByteArrayView view = d->backend->readPointer();
844 if (view.size()) {
845 qint64 bytesToCopy = qMin(qint64(view.size()), maxlen - bytesRead);
846 memcpy(data + bytesRead, view.data(), bytesToCopy); // from zero to one copy
847
848 // We might have to cache this
849 if (d->cacheEnabled && !d->cacheSaveDevice)
850 d->initCacheSaveDevice();
851 if (d->cacheEnabled && d->cacheSaveDevice)
852 d->cacheSaveDevice->write(view.data(), view.size());
853
854 bytesRead += bytesToCopy;
855 d->backend->advanceReadPointer(bytesToCopy);
856 } else {
857 break;
858 }
859 }
860 QVariant totalSize = d->cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
861 emit downloadProgress(bytesRead,
862 totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
863 return bytesRead;
864 } else if (d->backend && d->backend->bytesAvailable()) {
865 return d->backend->read(data, maxlen);
866 }
867
868 // Special case code if we have the "zero copy" download buffer
869 if (d->downloadBuffer) {
870 qint64 maxAvail = qMin<qint64>(d->downloadBufferCurrentSize - d->downloadBufferReadPosition, maxlen);
871 if (maxAvail == 0)
872 return d->state == QNetworkReplyPrivate::Finished ? -1 : 0;
873 // FIXME what about "Aborted" state?
874 memcpy(data, d->downloadBuffer + d->downloadBufferReadPosition, maxAvail);
875 d->downloadBufferReadPosition += maxAvail;
876 return maxAvail;
877 }
878
879
880 // FIXME what about "Aborted" state?
881 if (d->state == QNetworkReplyPrivate::Finished)
882 return -1;
883
885 return 0;
886}
887
892{
893 if (e->type() == QEvent::NetworkReplyUpdated) {
894 d_func()->handleNotifications();
895 return true;
896 }
897
898 return QObject::event(e);
899}
900
902
903#include "moc_qnetworkreplyimpl_p.cpp"
904
The QAbstractNetworkCache class provides the interface for cache implementations.
virtual void insert(QIODevice *device)=0
Inserts the data in device and the prepared meta data into the cache.
virtual QIODevice * prepare(const QNetworkCacheMetaData &metaData)=0
Returns the device that should be populated with the data for the cache item metaData.
virtual bool remove(const QUrl &url)=0
Removes the cache entry for url, returning true if success otherwise false.
\inmodule QtCore
Definition qbytearray.h:57
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
void invalidate() noexcept
Marks this QElapsedTimer object as invalid.
qint64 elapsed() const noexcept
Returns the number of milliseconds since this QElapsedTimer was last started.
qint64 restart() noexcept
Restarts the timer and returns the number of milliseconds elapsed since the previous start.
void start() noexcept
Starts this timer.
bool isValid() const noexcept
Returns false if the timer has never been started or invalidated by a call to invalidate().
\inmodule QtCore
Definition qcoreevent.h:45
@ NetworkReplyUpdated
Definition qcoreevent.h:231
const_iterator constFind(const Key &key) const noexcept
Definition qhash.h:1279
T value(const Key &key) const noexcept
Definition qhash.h:1044
const_iterator cend() const noexcept
Definition qhash.h:1208
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition qhash.h:1283
\inmodule QtCore \reentrant
Definition qiodevice.h:34
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
bool isOpen() const
Returns true if the device is open; otherwise returns false.
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
virtual qint64 bytesAvailable() const
Returns the number of bytes that are available for reading.
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i....
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read.
Definition qlist.h:74
virtual qint64 read(char *data, qint64 maxlen)
Implement this function to support reading from the resource made available by your plugin.
virtual bool start()
Prepares the backend and calls open().
bool needsResetableUploadData() const noexcept
virtual bool wantToRead()
This is called before we read if there are no bytes available and we are ready to read more.
virtual qint64 bytesAvailable() const =0
You must implement this function in your derived class.
QAbstractNetworkCache * networkCache() const
Returns the network cache object that was available when the request was started.
IOFeatures ioFeatures() const noexcept
Returns the I/O features that the backend claims to support.
Operation
Indicates the operation this reply is processing.
QNetworkCookieJar * cookieJar() const
Returns the QNetworkCookieJar that is used to store cookies obtained from the network as well as cook...
The QNetworkCacheMetaData class provides cache information.
void setUrl(const QUrl &url)
Sets the URL this network cache meta data to be url.
AttributesMap attributes() const
void setAttributes(const AttributesMap &attributes)
The QNetworkCookieJar class implements a simple jar of QNetworkCookie objects.
virtual bool setCookiesFromUrl(const QList< QNetworkCookie > &cookieList, const QUrl &url)
Adds the cookies in the list cookieList to this cookie jar.
CookedHeadersMap cookedHeaders
std::vector< InternalNotifications > pendingNotifications
void setDownloadBuffer(QSharedPointer< char > sp, qint64 size)
void error(QNetworkReply::NetworkError code, const QString &errorString)
void appendDownstreamDataDownloadBuffer(qint64, qint64)
QSharedPointer< char > downloadBufferPointer
QNetworkAccessBackend * backend
void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
void emitUploadProgress(qint64 bytesSent, qint64 bytesTotal)
void backendNotify(InternalNotifications notification)
std::shared_ptr< QRingBuffer > outgoingDataBuffer
QAbstractNetworkCache * networkCache() const
void appendDownstreamData(QByteDataBuffer &data)
char * getDownloadBuffer(qint64 size)
void sslErrors(const QList< QSslError > &errors)
void redirectionRequested(const QUrl &target)
void setCachingEnabled(bool enable)
virtual qint64 bytesAvailable() const override
Returns the number of bytes available for reading with QIODevice::read().
virtual qint64 readData(char *data, qint64 maxlen) override
QNetworkReplyImpl(QObject *parent=nullptr)
virtual void ignoreSslErrorsImplementation(const QList< QSslError > &errors) override
virtual void setReadBufferSize(qint64 size) override
Sets the size of the read buffer to be size bytes.
virtual void close() override
Closes this device for reading.
virtual void abort() override
Aborts the operation immediately and close down any network connections still open.
virtual bool event(QEvent *) override
void void void void _q_bufferOutgoingDataFinished()) protected void setSslConfigurationImplementation(const QSslConfiguration &configuration) override
virtual void ignoreSslErrors() override
If this function is called, SSL errors related to network connection will be ignored,...
QPointer< QNetworkAccessManager > manager
QElapsedTimer downloadProgressSignalChoke
QNetworkRequest request
static const int progressSignalInterval
QNetworkAccessManager::Operation operation
QNetworkRequest originalRequest
QElapsedTimer uploadProgressSignalChoke
QNetworkReply::NetworkError errorCode
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
virtual void setReadBufferSize(qint64 size)
Sets the size of the read buffer to be size bytes.
virtual void close() override
Closes this device for reading.
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
This signal is emitted to indicate the progress of the download part of this network request,...
NetworkError
Indicates all possible error conditions found during the processing of the request.
QUrl url() const
Returns the URL of the content downloaded or uploaded.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
@ EmitAllUploadProgressSignalsAttribute
QVariant attribute(Attribute code, const QVariant &defaultValue=QVariant()) const
Returns the attribute associated with the code code.
QVariant header(KnownHeaders header) const
Returns the value of the known network header header if it is present in this request.
QUrl url() const
Returns the URL this network request is referring to.
QDynamicMetaObjectData * metaObject
Definition qobject.h:77
\inmodule QtCore
Definition qobject.h:90
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
Definition qobject.cpp:1363
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3099
bool isNull() const
Returns true if the referenced object has been destroyed or if there is no referenced object; otherwi...
Definition qpointer.h:67
\inmodule QtCore
T * data() const noexcept
Returns the value of the pointer referenced by this object.
The QSslConfiguration class holds the configuration and state of an SSL connection.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qurl.h:94
QString scheme() const
Returns the scheme of the URL.
Definition qurl.cpp:1983
\inmodule QtCore
Definition qvariant.h:64
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
Definition qvariant.h:707
qlonglong toLongLong(bool *ok=nullptr) const
Returns the variant as a long long int if the variant has userType() \l QMetaType::LongLong,...
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
bool isNull() const
Returns true if this is a null variant, false otherwise.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:531
double e
QSet< QString >::iterator it
else opt state
[0]
Combined button and popup list for selecting options.
@ QueuedConnection
#define Q_UNLIKELY(x)
DBusConnection const char DBusError * error
EGLConfig config
#define forever
Definition qforeach.h:78
#define qCritical
Definition qlogging.h:163
#define qDebug
[1]
Definition qlogging.h:160
#define qWarning
Definition qlogging.h:162
#define QT_IMPL_METATYPE_EXTERN_TAGGED(TYPE, TAG)
Definition qmetatype.h:1363
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
#define SLOT(a)
Definition qobjectdefs.h:51
#define SIGNAL(a)
Definition qobjectdefs.h:52
GLenum GLsizei GLuint GLint * bytesWritten
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint buffer
GLenum GLenum dst
GLenum target
GLboolean enable
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
SSL_CTX int(*) void arg)
#define sp
#define tr(X)
#define emit
#define Q_UNUSED(x)
ptrdiff_t qsizetype
Definition qtypes.h:70
long long qint64
Definition qtypes.h:55
#define Q_INT64_C(c)
Definition qtypes.h:52
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
Definition qurl.cpp:3503
const char className[16]
[1]
Definition qwizard.cpp:100
myObject disconnect()
[26]
QGraphicsItem * item
QNetworkRequest request(url)
QQuickView * view
[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...
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent