access/qnetworkreply.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtNetwork module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qnetworkreply.h" -
43#include "qnetworkreply_p.h" -
44#include <QtNetwork/qsslconfiguration.h> -
45 -
46QT_BEGIN_NAMESPACE -
47 -
48const int QNetworkReplyPrivate::progressSignalInterval = 100; -
49 -
50QNetworkReplyPrivate::QNetworkReplyPrivate() -
51 : readBufferMaxSize(0), -
52 operation(QNetworkAccessManager::UnknownOperation), -
53 errorCode(QNetworkReply::NoError) -
54 , isFinished(false) -
55{ -
56 // set the default attribute values -
57 attributes.insert(QNetworkRequest::ConnectionEncryptedAttribute, false);
executed (the execution status of this line is deduced): attributes.insert(QNetworkRequest::ConnectionEncryptedAttribute, false);
-
58}
executed: }
Execution Count:874
874
59 -
60 -
61/*! -
62 \class QNetworkReply -
63 \since 4.4 -
64 \brief The QNetworkReply class contains the data and headers for a request -
65 sent with QNetworkAccessManager -
66 -
67 \reentrant -
68 \ingroup network -
69 \inmodule QtNetwork -
70 -
71 The QNetworkReply class contains the data and meta data related to -
72 a request posted with QNetworkAccessManager. Like QNetworkRequest, -
73 it contains a URL and headers (both in parsed and raw form), some -
74 information about the reply's state and the contents of the reply -
75 itself. -
76 -
77 QNetworkReply is a sequential-access QIODevice, which means that -
78 once data is read from the object, it no longer kept by the -
79 device. It is therefore the application's responsibility to keep -
80 this data if it needs to. Whenever more data is received from the -
81 network and processed, the readyRead() signal is emitted. -
82 -
83 The downloadProgress() signal is also emitted when data is -
84 received, but the number of bytes contained in it may not -
85 represent the actual bytes received, if any transformation is done -
86 to the contents (for example, decompressing and removing the -
87 protocol overhead). -
88 -
89 Even though QNetworkReply is a QIODevice connected to the contents -
90 of the reply, it also emits the uploadProgress() signal, which -
91 indicates the progress of the upload for operations that have such -
92 content. -
93 -
94 \note Do not delete the object in the slot connected to the -
95 error() or finished() signal. Use deleteLater(). -
96 -
97 \sa QNetworkRequest, QNetworkAccessManager -
98*/ -
99 -
100/*! -
101 \enum QNetworkReply::NetworkError -
102 -
103 Indicates all possible error conditions found during the -
104 processing of the request. -
105 -
106 \value NoError no error condition. -
107 \note When the HTTP protocol returns a redirect no error will be -
108 reported. You can check if there is a redirect with the -
109 QNetworkRequest::RedirectionTargetAttribute attribute. -
110 -
111 \value ConnectionRefusedError the remote server refused the -
112 connection (the server is not accepting requests) -
113 -
114 \value RemoteHostClosedError the remote server closed the -
115 connection prematurely, before the entire reply was received and -
116 processed -
117 -
118 \value HostNotFoundError the remote host name was not found -
119 (invalid hostname) -
120 -
121 \value TimeoutError the connection to the remote server -
122 timed out -
123 -
124 \value OperationCanceledError the operation was canceled via calls -
125 to abort() or close() before it was finished. -
126 -
127 \value SslHandshakeFailedError the SSL/TLS handshake failed and the -
128 encrypted channel could not be established. The sslErrors() signal -
129 should have been emitted. -
130 -
131 \value TemporaryNetworkFailureError the connection was broken due -
132 to disconnection from the network, however the system has initiated -
133 roaming to another access point. The request should be resubmitted -
134 and will be processed as soon as the connection is re-established. -
135 -
136 \value NetworkSessionFailedError the connection was broken due -
137 to disconnection from the network or failure to start the network. -
138 -
139 \value BackgroundRequestNotAllowedError the background request -
140 is not currently allowed due to platform policy. -
141 -
142 \value ProxyConnectionRefusedError the connection to the proxy -
143 server was refused (the proxy server is not accepting requests) -
144 -
145 \value ProxyConnectionClosedError the proxy server closed the -
146 connection prematurely, before the entire reply was received and -
147 processed -
148 -
149 \value ProxyNotFoundError the proxy host name was not -
150 found (invalid proxy hostname) -
151 -
152 \value ProxyTimeoutError the connection to the proxy -
153 timed out or the proxy did not reply in time to the request sent -
154 -
155 \value ProxyAuthenticationRequiredError the proxy requires -
156 authentication in order to honour the request but did not accept -
157 any credentials offered (if any) -
158 -
159 \value ContentAccessDenied the access to the remote -
160 content was denied (similar to HTTP error 401) -
161 -
162 \value ContentOperationNotPermittedError the operation requested -
163 on the remote content is not permitted -
164 -
165 \value ContentNotFoundError the remote content was not -
166 found at the server (similar to HTTP error 404) -
167 -
168 \value AuthenticationRequiredError the remote server requires -
169 authentication to serve the content but the credentials provided -
170 were not accepted (if any) -
171 -
172 \value ContentReSendError the request needed to be sent -
173 again, but this failed for example because the upload data -
174 could not be read a second time. -
175 -
176 \value ProtocolUnknownError the Network Access API cannot -
177 honor the request because the protocol is not known -
178 -
179 \value ProtocolInvalidOperationError the requested operation is -
180 invalid for this protocol -
181 -
182 \value UnknownNetworkError an unknown network-related -
183 error was detected -
184 -
185 \value UnknownProxyError an unknown proxy-related error -
186 was detected -
187 -
188 \value UnknownContentError an unknown error related to -
189 the remote content was detected -
190 -
191 \value ProtocolFailure a breakdown in protocol was -
192 detected (parsing error, invalid or unexpected responses, etc.) -
193 -
194 \sa error() -
195*/ -
196 -
197/*! -
198 \fn void QNetworkReply::sslErrors(const QList<QSslError> &errors) -
199 -
200 This signal is emitted if the SSL/TLS session encountered errors -
201 during the set up, including certificate verification errors. The -
202 \a errors parameter contains the list of errors. -
203 -
204 To indicate that the errors are not fatal and that the connection -
205 should proceed, the ignoreSslErrors() function should be called -
206 from the slot connected to this signal. If it is not called, the -
207 SSL session will be torn down before any data is exchanged -
208 (including the URL). -
209 -
210 This signal can be used to display an error message to the user -
211 indicating that security may be compromised and display the -
212 SSL settings (see sslConfiguration() to obtain it). If the user -
213 decides to proceed after analyzing the remote certificate, the -
214 slot should call ignoreSslErrors(). -
215 -
216 \sa QSslSocket::sslErrors(), QNetworkAccessManager::sslErrors(), -
217 sslConfiguration(), ignoreSslErrors() -
218*/ -
219 -
220/*! -
221 \fn void QNetworkReply::metaDataChanged() -
222 -
223 \omit FIXME: Update name? \endomit -
224 -
225 This signal is emitted whenever the metadata in this reply -
226 changes. metadata is any information that is not the content -
227 (data) itself, including the network headers. In the majority of -
228 cases, the metadata will be known fully by the time the first -
229 byte of data is received. However, it is possible to receive -
230 updates of headers or other metadata during the processing of the -
231 data. -
232 -
233 \sa header(), rawHeaderList(), rawHeader(), hasRawHeader() -
234*/ -
235 -
236/*! -
237 \fn void QNetworkReply::finished() -
238 -
239 This signal is emitted when the reply has finished -
240 processing. After this signal is emitted, there will be no more -
241 updates to the reply's data or metadata. -
242 -
243 Unless close() has been called, the reply will be still be opened -
244 for reading, so the data can be retrieved by calls to read() or -
245 readAll(). In particular, if no calls to read() were made as a -
246 result of readyRead(), a call to readAll() will retrieve the full -
247 contents in a QByteArray. -
248 -
249 This signal is emitted in tandem with -
250 QNetworkAccessManager::finished() where that signal's reply -
251 parameter is this object. -
252 -
253 \note Do not delete the object in the slot connected to this -
254 signal. Use deleteLater(). -
255 -
256 You can also use isFinished() to check if a QNetworkReply -
257 has finished even before you receive the finished() signal. -
258 -
259 \sa QNetworkAccessManager::finished(), isFinished() -
260*/ -
261 -
262/*! -
263 \fn void QNetworkReply::error(QNetworkReply::NetworkError code) -
264 -
265 This signal is emitted when the reply detects an error in -
266 processing. The finished() signal will probably follow, indicating -
267 that the connection is over. -
268 -
269 The \a code parameter contains the code of the error that was -
270 detected. Call errorString() to obtain a textual representation of -
271 the error condition. -
272 -
273 \note Do not delete the object in the slot connected to this -
274 signal. Use deleteLater(). -
275 -
276 \sa error(), errorString() -
277*/ -
278 -
279/*! -
280 \fn void QNetworkReply::uploadProgress(qint64 bytesSent, qint64 bytesTotal) -
281 -
282 This signal is emitted to indicate the progress of the upload part -
283 of this network request, if there's any. If there's no upload -
284 associated with this request, this signal will not be emitted. -
285 -
286 The \a bytesSent -
287 parameter indicates the number of bytes uploaded, while \a -
288 bytesTotal indicates the total number of bytes to be uploaded. If -
289 the number of bytes to be uploaded could not be determined, \a -
290 bytesTotal will be -1. -
291 -
292 The upload is finished when \a bytesSent is equal to \a -
293 bytesTotal. At that time, \a bytesTotal will not be -1. -
294 -
295 \sa downloadProgress() -
296*/ -
297 -
298/*! -
299 \fn void QNetworkReply::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) -
300 -
301 This signal is emitted to indicate the progress of the download -
302 part of this network request, if there's any. If there's no -
303 download associated with this request, this signal will be emitted -
304 once with 0 as the value of both \a bytesReceived and \a -
305 bytesTotal. -
306 -
307 The \a bytesReceived parameter indicates the number of bytes -
308 received, while \a bytesTotal indicates the total number of bytes -
309 expected to be downloaded. If the number of bytes to be downloaded -
310 is not known, \a bytesTotal will be -1. -
311 -
312 The download is finished when \a bytesReceived is equal to \a -
313 bytesTotal. At that time, \a bytesTotal will not be -1. -
314 -
315 Note that the values of both \a bytesReceived and \a bytesTotal -
316 may be different from size(), the total number of bytes -
317 obtained through read() or readAll(), or the value of the -
318 header(ContentLengthHeader). The reason for that is that there may -
319 be protocol overhead or the data may be compressed during the -
320 download. -
321 -
322 \sa uploadProgress(), bytesAvailable() -
323*/ -
324 -
325/*! -
326 \fn void QNetworkReply::abort() -
327 -
328 Aborts the operation immediately and close down any network -
329 connections still open. Uploads still in progress are also -
330 aborted. -
331 -
332 \sa close() -
333*/ -
334 -
335/*! -
336 Creates a QNetworkReply object with parent \a parent. -
337 -
338 You cannot directly instantiate QNetworkReply objects. Use -
339 QNetworkAccessManager functions to do that. -
340*/ -
341QNetworkReply::QNetworkReply(QObject *parent) -
342 : QIODevice(*new QNetworkReplyPrivate, parent) -
343{ -
344}
never executed: }
0
345 -
346/*! -
347 \internal -
348*/ -
349QNetworkReply::QNetworkReply(QNetworkReplyPrivate &dd, QObject *parent) -
350 : QIODevice(dd, parent) -
351{ -
352}
executed: }
Execution Count:874
874
353 -
354/*! -
355 Disposes of this reply and frees any resources associated with -
356 it. If any network connections are still open, they will be -
357 closed. -
358 -
359 \sa abort(), close() -
360*/ -
361QNetworkReply::~QNetworkReply() -
362{ -
363} -
364 -
365/*! -
366 Closes this device for reading. Unread data is discarded, but the -
367 network resources are not discarded until they are finished. In -
368 particular, if any upload is in progress, it will continue until -
369 it is done. -
370 -
371 The finished() signal is emitted when all operations are over and -
372 the network resources are freed. -
373 -
374 \sa abort(), finished() -
375*/ -
376void QNetworkReply::close() -
377{ -
378 QIODevice::close();
executed (the execution status of this line is deduced): QIODevice::close();
-
379}
executed: }
Execution Count:5
5
380 -
381/*! -
382 \internal -
383*/ -
384bool QNetworkReply::isSequential() const -
385{ -
386 return true;
executed: return true;
Execution Count:93
93
387} -
388 -
389/*! -
390 Returns the size of the read buffer, in bytes. -
391 -
392 \sa setReadBufferSize() -
393*/ -
394qint64 QNetworkReply::readBufferSize() const -
395{ -
396 return d_func()->readBufferMaxSize;
executed: return d_func()->readBufferMaxSize;
Execution Count:1170
1170
397} -
398 -
399/*! -
400 Sets the size of the read buffer to be \a size bytes. The read -
401 buffer is the buffer that holds data that is being downloaded off -
402 the network, before it is read with QIODevice::read(). Setting the -
403 buffer size to 0 will make the buffer unlimited in size. -
404 -
405 QNetworkReply will try to stop reading from the network once this -
406 buffer is full (i.e., bytesAvailable() returns \a size or more), -
407 thus causing the download to throttle down as well. If the buffer -
408 is not limited in size, QNetworkReply will try to download as fast -
409 as possible from the network. -
410 -
411 Unlike QAbstractSocket::setReadBufferSize(), QNetworkReply cannot -
412 guarantee precision in the read buffer size. That is, -
413 bytesAvailable() can return more than \a size. -
414 -
415 \sa readBufferSize() -
416*/ -
417void QNetworkReply::setReadBufferSize(qint64 size) -
418{ -
419 Q_D(QNetworkReply);
executed (the execution status of this line is deduced): QNetworkReplyPrivate * const d = d_func();
-
420 d->readBufferMaxSize = size;
executed (the execution status of this line is deduced): d->readBufferMaxSize = size;
-
421}
executed: }
Execution Count:11
11
422 -
423/*! -
424 Returns the QNetworkAccessManager that was used to create this -
425 QNetworkReply object. Initially, it is also the parent object. -
426*/ -
427QNetworkAccessManager *QNetworkReply::manager() const -
428{ -
429 return d_func()->manager;
executed: return d_func()->manager;
Execution Count:1
1
430} -
431 -
432/*! -
433 Returns the request that was posted for this reply. In special, -
434 note that the URL for the request may be different than that of -
435 the reply. -
436 -
437 \sa QNetworkRequest::url(), url(), setRequest() -
438*/ -
439QNetworkRequest QNetworkReply::request() const -
440{ -
441 return d_func()->request;
executed: return d_func()->request;
Execution Count:1
1
442} -
443 -
444/*! -
445 Returns the operation that was posted for this reply. -
446 -
447 \sa setOperation() -
448*/ -
449QNetworkAccessManager::Operation QNetworkReply::operation() const -
450{ -
451 return d_func()->operation;
executed: return d_func()->operation;
Execution Count:1
1
452} -
453 -
454/*! -
455 Returns the error that was found during the processing of this -
456 request. If no error was found, returns NoError. -
457 -
458 \sa setError() -
459*/ -
460QNetworkReply::NetworkError QNetworkReply::error() const -
461{ -
462 return d_func()->errorCode;
executed: return d_func()->errorCode;
Execution Count:1125
1125
463} -
464 -
465/*! -
466 \since 4.6 -
467 -
468 Returns true when the reply has finished or was aborted. -
469 -
470 \sa isRunning() -
471*/ -
472bool QNetworkReply::isFinished() const -
473{ -
474 return d_func()->isFinished;
executed: return d_func()->isFinished;
Execution Count:4264
4264
475} -
476 -
477/*! -
478 \since 4.6 -
479 -
480 Returns true when the request is still processing and the -
481 reply has not finished or was aborted yet. -
482 -
483 \sa isFinished() -
484*/ -
485bool QNetworkReply::isRunning() const -
486{ -
487 return !isFinished();
executed: return !isFinished();
Execution Count:16
16
488} -
489 -
490/*! -
491 Returns the URL of the content downloaded or uploaded. Note that -
492 the URL may be different from that of the original request. -
493 -
494 \sa request(), setUrl(), QNetworkRequest::url() -
495*/ -
496QUrl QNetworkReply::url() const -
497{ -
498 return d_func()->url;
executed: return d_func()->url;
Execution Count:394
394
499} -
500 -
501/*! -
502 Returns the value of the known header \a header, if that header -
503 was sent by the remote server. If the header was not sent, returns -
504 an invalid QVariant. -
505 -
506 \sa rawHeader(), setHeader(), QNetworkRequest::header() -
507*/ -
508QVariant QNetworkReply::header(QNetworkRequest::KnownHeaders header) const -
509{ -
510 return d_func()->cookedHeaders.value(header);
executed: return d_func()->cookedHeaders.value(header);
Execution Count:322
322
511} -
512 -
513/*! -
514 Returns true if the raw header of name \a headerName was sent by -
515 the remote server -
516 -
517 \sa rawHeader() -
518*/ -
519bool QNetworkReply::hasRawHeader(const QByteArray &headerName) const -
520{ -
521 Q_D(const QNetworkReply);
never executed (the execution status of this line is deduced): const QNetworkReplyPrivate * const d = d_func();
-
522 return d->findRawHeader(headerName) != d->rawHeaders.constEnd();
never executed: return d->findRawHeader(headerName) != d->rawHeaders.constEnd();
0
523} -
524 -
525/*! -
526 Returns the raw contents of the header \a headerName as sent by -
527 the remote server. If there is no such header, returns an empty -
528 byte array, which may be indistinguishable from an empty -
529 header. Use hasRawHeader() to verify if the server sent such -
530 header field. -
531 -
532 \sa setRawHeader(), hasRawHeader(), header() -
533*/ -
534QByteArray QNetworkReply::rawHeader(const QByteArray &headerName) const -
535{ -
536 Q_D(const QNetworkReply);
executed (the execution status of this line is deduced): const QNetworkReplyPrivate * const d = d_func();
-
537 QNetworkHeadersPrivate::RawHeadersList::ConstIterator it =
executed (the execution status of this line is deduced): QNetworkHeadersPrivate::RawHeadersList::ConstIterator it =
-
538 d->findRawHeader(headerName);
executed (the execution status of this line is deduced): d->findRawHeader(headerName);
-
539 if (it != d->rawHeaders.constEnd())
evaluated: it != d->rawHeaders.constEnd()
TRUEFALSE
yes
Evaluation Count:410
yes
Evaluation Count:4220
410-4220
540 return it->second;
executed: return it->second;
Execution Count:410
410
541 return QByteArray();
executed: return QByteArray();
Execution Count:4220
4220
542} -
543 -
544/*! \typedef QNetworkReply::RawHeaderPair -
545 -
546 RawHeaderPair is a QPair<QByteArray, QByteArray> where the first -
547 QByteArray is the header name and the second is the header. -
548 */ -
549 -
550/*! -
551 Returns a list of raw header pairs. -
552 */ -
553const QList<QNetworkReply::RawHeaderPair>& QNetworkReply::rawHeaderPairs() const -
554{ -
555 Q_D(const QNetworkReply);
never executed (the execution status of this line is deduced): const QNetworkReplyPrivate * const d = d_func();
-
556 return d->rawHeaders;
never executed: return d->rawHeaders;
0
557} -
558 -
559/*! -
560 Returns a list of headers fields that were sent by the remote -
561 server, in the order that they were sent. Duplicate headers are -
562 merged together and take place of the latter duplicate. -
563*/ -
564QList<QByteArray> QNetworkReply::rawHeaderList() const -
565{ -
566 return d_func()->rawHeadersKeys();
executed: return d_func()->rawHeadersKeys();
Execution Count:115
115
567} -
568 -
569/*! -
570 Returns the attribute associated with the code \a code. If the -
571 attribute has not been set, it returns an invalid QVariant (type QMetaType::Unknown). -
572 -
573 You can expect the default values listed in -
574 QNetworkRequest::Attribute to be applied to the values returned by -
575 this function. -
576 -
577 \sa setAttribute(), QNetworkRequest::Attribute -
578*/ -
579QVariant QNetworkReply::attribute(QNetworkRequest::Attribute code) const -
580{ -
581 return d_func()->attributes.value(code);
executed: return d_func()->attributes.value(code);
Execution Count:511
511
582} -
583 -
584#ifndef QT_NO_SSL -
585/*! -
586 Returns the SSL configuration and state associated with this -
587 reply, if SSL was used. It will contain the remote server's -
588 certificate, its certificate chain leading to the Certificate -
589 Authority as well as the encryption ciphers in use. -
590 -
591 The peer's certificate and its certificate chain will be known by -
592 the time sslErrors() is emitted, if it's emitted. -
593*/ -
594QSslConfiguration QNetworkReply::sslConfiguration() const -
595{ -
596 QSslConfiguration config;
executed (the execution status of this line is deduced): QSslConfiguration config;
-
597 sslConfigurationImplementation(config);
executed (the execution status of this line is deduced): sslConfigurationImplementation(config);
-
598 return config;
executed: return config;
Execution Count:21
21
599} -
600 -
601/*! -
602 Sets the SSL configuration for the network connection associated -
603 with this request, if possible, to be that of \a config. -
604*/ -
605void QNetworkReply::setSslConfiguration(const QSslConfiguration &config) -
606{ -
607 setSslConfigurationImplementation(config);
executed (the execution status of this line is deduced): setSslConfigurationImplementation(config);
-
608}
executed: }
Execution Count:89
89
609 -
610/*! -
611 \overload -
612 \since 4.6 -
613 -
614 If this function is called, the SSL errors given in \a errors -
615 will be ignored. -
616 -
617 Note that you can set the expected certificate in the SSL error: -
618 If, for instance, you want to issue a request to a server that uses -
619 a self-signed certificate, consider the following snippet: -
620 -
621 \snippet code/src_network_access_qnetworkreply.cpp 0 -
622 -
623 Multiple calls to this function will replace the list of errors that -
624 were passed in previous calls. -
625 You can clear the list of errors you want to ignore by calling this -
626 function with an empty list. -
627 -
628 \sa sslConfiguration(), sslErrors(), QSslSocket::ignoreSslErrors() -
629*/ -
630void QNetworkReply::ignoreSslErrors(const QList<QSslError> &errors) -
631{ -
632 ignoreSslErrorsImplementation(errors);
executed (the execution status of this line is deduced): ignoreSslErrorsImplementation(errors);
-
633}
executed: }
Execution Count:10
10
634#endif -
635 -
636/*! -
637 \fn void QNetworkReply::sslConfigurationImplementation(QSslConfiguration &configuration) const -
638 \since 5.0 -
639 -
640 This virtual method is provided to enable overriding the behavior of -
641 sslConfiguration(). sslConfiguration() is a public wrapper for this method. -
642 The configuration will be returned in \a configuration. -
643 -
644 \sa sslConfiguration() -
645*/ -
646void QNetworkReply::sslConfigurationImplementation(QSslConfiguration &) const -
647{ -
648} -
649 -
650/*! -
651 \fn void QNetworkReply::setSslConfigurationImplementation(const QSslConfiguration &configuration) -
652 \since 5.0 -
653 -
654 This virtual method is provided to enable overriding the behavior of -
655 setSslConfiguration(). setSslConfiguration() is a public wrapper for this method. -
656 If you override this method use \a configuration to set the SSL configuration. -
657 -
658 \sa sslConfigurationImplementation(), setSslConfiguration() -
659*/ -
660void QNetworkReply::setSslConfigurationImplementation(const QSslConfiguration &) -
661{ -
662} -
663 -
664/*! -
665 \fn void QNetworkReply::ignoreSslErrorsImplementation(const QList<QSslError> &errors) -
666 \since 5.0 -
667 -
668 This virtual method is provided to enable overriding the behavior of -
669 ignoreSslErrors(). ignoreSslErrors() is a public wrapper for this method. -
670 \a errors contains the errors the user wishes ignored. -
671 -
672 \sa ignoreSslErrors() -
673*/ -
674void QNetworkReply::ignoreSslErrorsImplementation(const QList<QSslError> &) -
675{ -
676} -
677 -
678/*! -
679 If this function is called, SSL errors related to network -
680 connection will be ignored, including certificate validation -
681 errors. -
682 -
683 \warning Be sure to always let the user inspect the errors -
684 reported by the sslErrors() signal, and only call this method -
685 upon confirmation from the user that proceeding is ok. -
686 If there are unexpected errors, the reply should be aborted. -
687 Calling this method without inspecting the actual errors will -
688 most likely pose a security risk for your application. Use it -
689 with great care! -
690 -
691 This function can be called from the slot connected to the -
692 sslErrors() signal, which indicates which errors were -
693 found. -
694 -
695 \sa sslConfiguration(), sslErrors(), QSslSocket::ignoreSslErrors() -
696*/ -
697void QNetworkReply::ignoreSslErrors() -
698{ -
699} -
700 -
701/*! -
702 \internal -
703*/ -
704qint64 QNetworkReply::writeData(const char *, qint64) -
705{ -
706 return -1; // you can't write
never executed: return -1;
0
707} -
708 -
709/*! -
710 Sets the associated operation for this object to be \a -
711 operation. This value will be returned by operation(). -
712 -
713 Note: the operation should be set when this object is created and -
714 not changed again. -
715 -
716 \sa operation(), setRequest() -
717*/ -
718void QNetworkReply::setOperation(QNetworkAccessManager::Operation operation) -
719{ -
720 Q_D(QNetworkReply);
executed (the execution status of this line is deduced): QNetworkReplyPrivate * const d = d_func();
-
721 d->operation = operation;
executed (the execution status of this line is deduced): d->operation = operation;
-
722}
executed: }
Execution Count:59
59
723 -
724/*! -
725 Sets the associated request for this object to be \a request. This -
726 value will be returned by request(). -
727 -
728 Note: the request should be set when this object is created and -
729 not changed again. -
730 -
731 \sa request(), setOperation() -
732*/ -
733void QNetworkReply::setRequest(const QNetworkRequest &request) -
734{ -
735 Q_D(QNetworkReply);
executed (the execution status of this line is deduced): QNetworkReplyPrivate * const d = d_func();
-
736 d->request = request;
executed (the execution status of this line is deduced): d->request = request;
-
737}
executed: }
Execution Count:59
59
738 -
739/*! -
740 Sets the error condition to be \a errorCode. The human-readable -
741 message is set with \a errorString. -
742 -
743 Calling setError() does not emit the error(QNetworkReply::NetworkError) -
744 signal. -
745 -
746 \sa error(), errorString() -
747*/ -
748void QNetworkReply::setError(NetworkError errorCode, const QString &errorString) -
749{ -
750 Q_D(QNetworkReply);
executed (the execution status of this line is deduced): QNetworkReplyPrivate * const d = d_func();
-
751 d->errorCode = errorCode;
executed (the execution status of this line is deduced): d->errorCode = errorCode;
-
752 setErrorString(errorString); // in QIODevice
executed (the execution status of this line is deduced): setErrorString(errorString);
-
753}
executed: }
Execution Count:7
7
754 -
755/*! -
756 \since 4.8 -
757 Sets the reply as \a finished. -
758 -
759 After having this set the replies data must not change. -
760 -
761 \sa isFinished() -
762*/ -
763void QNetworkReply::setFinished(bool finished) -
764{ -
765 Q_D(QNetworkReply);
executed (the execution status of this line is deduced): QNetworkReplyPrivate * const d = d_func();
-
766 d->isFinished = finished;
executed (the execution status of this line is deduced): d->isFinished = finished;
-
767}
executed: }
Execution Count:934
934
768 -
769 -
770/*! -
771 Sets the URL being processed to be \a url. Normally, the URL -
772 matches that of the request that was posted, but for a variety of -
773 reasons it can be different (for example, a file path being made -
774 absolute or canonical). -
775 -
776 \sa url(), request(), QNetworkRequest::url() -
777*/ -
778void QNetworkReply::setUrl(const QUrl &url) -
779{ -
780 Q_D(QNetworkReply);
executed (the execution status of this line is deduced): QNetworkReplyPrivate * const d = d_func();
-
781 d->url = url;
executed (the execution status of this line is deduced): d->url = url;
-
782}
executed: }
Execution Count:87
87
783 -
784/*! -
785 Sets the known header \a header to be of value \a value. The -
786 corresponding raw form of the header will be set as well. -
787 -
788 \sa header(), setRawHeader(), QNetworkRequest::setHeader() -
789*/ -
790void QNetworkReply::setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value) -
791{ -
792 Q_D(QNetworkReply);
executed (the execution status of this line is deduced): QNetworkReplyPrivate * const d = d_func();
-
793 d->setCookedHeader(header, value);
executed (the execution status of this line is deduced): d->setCookedHeader(header, value);
-
794}
executed: }
Execution Count:104
104
795 -
796/*! -
797 Sets the raw header \a headerName to be of value \a value. If \a -
798 headerName was previously set, it is overridden. Multiple HTTP -
799 headers of the same name are functionally equivalent to one single -
800 header with the values concatenated, separated by commas. -
801 -
802 If \a headerName matches a known header, the value \a value will -
803 be parsed and the corresponding parsed form will also be set. -
804 -
805 \sa rawHeader(), header(), setHeader(), QNetworkRequest::setRawHeader() -
806*/ -
807void QNetworkReply::setRawHeader(const QByteArray &headerName, const QByteArray &value) -
808{ -
809 Q_D(QNetworkReply);
executed (the execution status of this line is deduced): QNetworkReplyPrivate * const d = d_func();
-
810 d->setRawHeader(headerName, value);
executed (the execution status of this line is deduced): d->setRawHeader(headerName, value);
-
811}
executed: }
Execution Count:4216
4216
812 -
813/*! -
814 Sets the attribute \a code to have value \a value. If \a code was -
815 previously set, it will be overridden. If \a value is an invalid -
816 QVariant, the attribute will be unset. -
817 -
818 \sa attribute(), QNetworkRequest::setAttribute() -
819*/ -
820void QNetworkReply::setAttribute(QNetworkRequest::Attribute code, const QVariant &value) -
821{ -
822 Q_D(QNetworkReply);
executed (the execution status of this line is deduced): QNetworkReplyPrivate * const d = d_func();
-
823 if (value.isValid())
evaluated: value.isValid()
TRUEFALSE
yes
Evaluation Count:3029
yes
Evaluation Count:8
8-3029
824 d->attributes.insert(code, value);
executed: d->attributes.insert(code, value);
Execution Count:3029
3029
825 else -
826 d->attributes.remove(code);
executed: d->attributes.remove(code);
Execution Count:8
8
827} -
828 -
829QT_END_NAMESPACE -
830 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial