qhttpnetworkrequest.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpnetworkrequest.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtNetwork module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
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 The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qhttpnetworkrequest_p.h"-
35#include "private/qnoncontiguousbytedevice_p.h"-
36-
37#ifndef QT_NO_HTTP-
38-
39QT_BEGIN_NAMESPACE-
40-
41QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,-
42 QHttpNetworkRequest::Priority pri, const QUrl &newUrl)-
43 : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),-
44 autoDecompress(false), pipeliningAllowed(false), spdyAllowed(false),-
45 withCredentials(true), preConnect(false), followRedirect(false), redirectCount(0)-
46{-
47}
executed 9653 times by 15 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
9653
48-
49QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequestPrivate &other)-
50 : QHttpNetworkHeaderPrivate(other)-
51{-
52 operation = other.operation;-
53 priority = other.priority;-
54 uploadByteDevice = other.uploadByteDevice;-
55 autoDecompress = other.autoDecompress;-
56 pipeliningAllowed = other.pipeliningAllowed;-
57 spdyAllowed = other.spdyAllowed;-
58 customVerb = other.customVerb;-
59 withCredentials = other.withCredentials;-
60 ssl = other.ssl;-
61 preConnect = other.preConnect;-
62 followRedirect = other.followRedirect;-
63 redirectCount = other.redirectCount;-
64}
executed 2185 times by 9 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
2185
65-
66QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate()-
67{-
68}-
69-
70bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &other) const-
71{-
72 return QHttpNetworkHeaderPrivate::operator==(other)
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
QHttpNetworkHe...rator==(other)Description
TRUEnever evaluated
FALSEnever evaluated
0
73 && (operation == other.operation)
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
(operation == other.operation)Description
TRUEnever evaluated
FALSEnever evaluated
0
74 && (priority == other.priority)
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
(priority == other.priority)Description
TRUEnever evaluated
FALSEnever evaluated
0
75 && (uploadByteDevice == other.uploadByteDevice)
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
(uploadByteDev...oadByteDevice)Description
TRUEnever evaluated
FALSEnever evaluated
0
76 && (autoDecompress == other.autoDecompress)
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
(autoDecompres...utoDecompress)Description
TRUEnever evaluated
FALSEnever evaluated
0
77 && (pipeliningAllowed == other.pipeliningAllowed)
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
(pipeliningAll...liningAllowed)Description
TRUEnever evaluated
FALSEnever evaluated
0
78 && (spdyAllowed == other.spdyAllowed)
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
(spdyAllowed =...r.spdyAllowed)Description
TRUEnever evaluated
FALSEnever evaluated
0
79 // we do not clear the customVerb in setOperation
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
0
80 && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb))
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
operation != Q...equest::CustomDescription
TRUEnever evaluated
FALSEnever evaluated
(customVerb ==...er.customVerb)Description
TRUEnever evaluated
FALSEnever evaluated
0
81 && (withCredentials == other.withCredentials)
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
(withCredentia...thCredentials)Description
TRUEnever evaluated
FALSEnever evaluated
0
82 && (ssl == other.ssl)
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
(ssl == other.ssl)Description
TRUEnever evaluated
FALSEnever evaluated
0
83 && (preConnect == other.preConnect);
never executed: return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) && (priority == other.priority) && (uploadByteDevice == other.uploadByteDevice) && (autoDecompress == other.autoDecompress) && (pipeliningAllowed == other.pipeliningAllowed) && (spdyAllowed == other.spdyAllowed) && (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb)) && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect);
(preConnect ==...er.preConnect)Description
TRUEnever evaluated
FALSEnever evaluated
0
84}-
85-
86QByteArray QHttpNetworkRequest::methodName() const-
87{-
88 switch (d->operation) {-
89 case QHttpNetworkRequest::Get:
executed 1605 times by 8 tests: case QHttpNetworkRequest::Get:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qnetworkreply - unknown status
1605
90 return "GET";
executed 1605 times by 8 tests: return "GET";
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qnetworkreply - unknown status
1605
91 case QHttpNetworkRequest::Head:
executed 118 times by 2 tests: case QHttpNetworkRequest::Head:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
118
92 return "HEAD";
executed 118 times by 2 tests: return "HEAD";
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
118
93 case QHttpNetworkRequest::Post:
executed 248 times by 4 tests: case QHttpNetworkRequest::Post:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
248
94 return "POST";
executed 248 times by 4 tests: return "POST";
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
248
95 case QHttpNetworkRequest::Options:
never executed: case QHttpNetworkRequest::Options:
0
96 return "OPTIONS";
never executed: return "OPTIONS";
0
97 case QHttpNetworkRequest::Put:
executed 38 times by 3 tests: case QHttpNetworkRequest::Put:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
38
98 return "PUT";
executed 38 times by 3 tests: return "PUT";
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
38
99 case QHttpNetworkRequest::Delete:
executed 7 times by 1 test: case QHttpNetworkRequest::Delete:
Executed by:
  • tst_QNetworkReply
7
100 return "DELETE";
executed 7 times by 1 test: return "DELETE";
Executed by:
  • tst_QNetworkReply
7
101 case QHttpNetworkRequest::Trace:
never executed: case QHttpNetworkRequest::Trace:
0
102 return "TRACE";
never executed: return "TRACE";
0
103 case QHttpNetworkRequest::Connect:
never executed: case QHttpNetworkRequest::Connect:
0
104 return "CONNECT";
never executed: return "CONNECT";
0
105 case QHttpNetworkRequest::Custom:
executed 7 times by 1 test: case QHttpNetworkRequest::Custom:
Executed by:
  • tst_QNetworkReply
7
106 return d->customVerb;
executed 7 times by 1 test: return d->customVerb;
Executed by:
  • tst_QNetworkReply
7
107 default:
never executed: default:
0
108 break;
never executed: break;
0
109 }-
110 return QByteArray();
never executed: return QByteArray();
0
111}-
112-
113QByteArray QHttpNetworkRequest::uri(bool throughProxy) const-
114{-
115 QUrl::FormattingOptions format(QUrl::RemoveFragment | QUrl::RemoveUserInfo | QUrl::FullyEncoded);-
116-
117 // for POST, query data is sent as content-
118 if (d->operation == QHttpNetworkRequest::Post && !d->uploadByteDevice)
d->operation =...kRequest::PostDescription
TRUEevaluated 248 times by 4 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 1775 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qnetworkreply - unknown status
!d->uploadByteDeviceDescription
TRUEnever evaluated
FALSEevaluated 248 times by 4 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
0-1775
119 format |= QUrl::RemoveQuery;
never executed: format |= QUrl::RemoveQuery;
0
120 // for requests through proxy, the Request-URI contains full url-
121 if (!throughProxy)
!throughProxyDescription
TRUEevaluated 1924 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
FALSEevaluated 99 times by 1 test
Evaluated by:
  • tst_QNetworkReply
99-1924
122 format |= QUrl::RemoveScheme | QUrl::RemoveAuthority;
executed 1924 times by 9 tests: format |= QUrl::RemoveScheme | QUrl::RemoveAuthority;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
1924
123 QUrl copy = d->url;-
124 if (copy.path().isEmpty())
copy.path().isEmpty()Description
TRUEevaluated 255 times by 7 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
FALSEevaluated 1768 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
255-1768
125 copy.setPath(QStringLiteral("/"));
executed 255 times by 7 tests: copy.setPath(([]() -> QString { enum { Size = sizeof(u"" "/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
executed 255 times by 7 tests: return qstring_literal_temp;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
255
126 QByteArray uri = copy.toEncoded(format);-
127 return uri;
executed 2023 times by 9 tests: return uri;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
2023
128}-
129-
130QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request, bool throughProxy)-
131{-
132 QList<QPair<QByteArray, QByteArray> > fields = request.header();-
133 QByteArray ba;-
134 ba.reserve(40 + fields.length()*25); // very rough lower bound estimation-
135-
136 ba += request.methodName();-
137 ba += ' ';-
138 ba += request.uri(throughProxy);-
139-
140 ba += " HTTP/";-
141 ba += QByteArray::number(request.majorVersion());-
142 ba += '.';-
143 ba += QByteArray::number(request.minorVersion());-
144 ba += "\r\n";-
145-
146 QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin();-
147 QList<QPair<QByteArray, QByteArray> >::const_iterator endIt = fields.constEnd();-
148 for (; it != endIt; ++it) {
it != endItDescription
TRUEevaluated 9309 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
FALSEevaluated 1726 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
1726-9309
149 ba += it->first;-
150 ba += ": ";-
151 ba += it->second;-
152 ba += "\r\n";-
153 }
executed 9309 times by 9 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
9309
154 if (request.d->operation == QHttpNetworkRequest::Post) {
request.d->ope...kRequest::PostDescription
TRUEevaluated 187 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
FALSEevaluated 1539 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qnetworkreply - unknown status
187-1539
155 // add content type, if not set in the request-
156 if (request.headerField("content-type").isEmpty() && ((request.d->uploadByteDevice && request.d->uploadByteDevice->size() > 0) || request.d->url.hasQuery())) {
request.header...pe").isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEevaluated 185 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
request.d->uploadByteDeviceDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEnever evaluated
request.d->upl...ce->size() > 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEnever evaluated
request.d->url.hasQuery()Description
TRUEnever evaluated
FALSEnever evaluated
0-185
157 //Content-Type is mandatory. We can't say anything about the encoding, but x-www-form-urlencoded is the most likely to work.-
158 //This warning indicates a bug in application code not setting a required header.-
159 //Note that if using QHttpMultipart, the content-type is set in QNetworkAccessManagerPrivate::prepareMultipart already-
160 qWarning("content-type missing in HTTP POST, defaulting to application/x-www-form-urlencoded. Use QNetworkRequest::setHeader() to fix this problem.");-
161 ba += "Content-Type: application/x-www-form-urlencoded\r\n";-
162 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QHttpNetworkConnection
2
163 if (!request.d->uploadByteDevice && request.d->url.hasQuery()) {
!request.d->uploadByteDeviceDescription
TRUEnever evaluated
FALSEevaluated 187 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
request.d->url.hasQuery()Description
TRUEnever evaluated
FALSEnever evaluated
0-187
164 QByteArray query = request.d->url.query(QUrl::FullyEncoded).toLatin1();-
165 ba += "Content-Length: ";-
166 ba += QByteArray::number(query.size());-
167 ba += "\r\n\r\n";-
168 ba += query;-
169 } else {
never executed: end of block
0
170 ba += "\r\n";-
171 }
executed 187 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
187
172 } else {-
173 ba += "\r\n";-
174 }
executed 1539 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qnetworkreply - unknown status
1539
175 return ba;
executed 1726 times by 9 tests: return ba;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
1726
176}-
177-
178-
179// QHttpNetworkRequest-
180-
181QHttpNetworkRequest::QHttpNetworkRequest(const QUrl &url, Operation operation, Priority priority)-
182 : d(new QHttpNetworkRequestPrivate(operation, priority, url))-
183{-
184}
executed 9653 times by 15 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
9653
185-
186QHttpNetworkRequest::QHttpNetworkRequest(const QHttpNetworkRequest &other)-
187 : QHttpNetworkHeader(other), d(other.d)-
188{-
189}
executed 13222 times by 9 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
13222
190-
191QHttpNetworkRequest::~QHttpNetworkRequest()-
192{-
193}-
194-
195QUrl QHttpNetworkRequest::url() const-
196{-
197 return d->url;
executed 8632 times by 9 tests: return d->url;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
8632
198}-
199void QHttpNetworkRequest::setUrl(const QUrl &url)-
200{-
201 d->url = url;-
202}
executed 916 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
916
203-
204bool QHttpNetworkRequest::isSsl() const-
205{-
206 return d->ssl;
executed 1753 times by 8 tests: return d->ssl;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1753
207}-
208void QHttpNetworkRequest::setSsl(bool s)-
209{-
210 d->ssl = s;-
211}
executed 890 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
890
212-
213bool QHttpNetworkRequest::isPreConnect() const-
214{-
215 return d->preConnect;
executed 1646 times by 8 tests: return d->preConnect;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1646
216}-
217void QHttpNetworkRequest::setPreConnect(bool preConnect)-
218{-
219 d->preConnect = preConnect;-
220}
executed 890 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
890
221-
222bool QHttpNetworkRequest::isFollowRedirects() const-
223{-
224 return d->followRedirect;
executed 14417 times by 8 tests: return d->followRedirect;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qnetworkreply - unknown status
14417
225}-
226-
227void QHttpNetworkRequest::setFollowRedirects(bool followRedirect)-
228{-
229 d->followRedirect = followRedirect;-
230}
executed 9 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
9
231-
232int QHttpNetworkRequest::redirectCount() const-
233{-
234 return d->redirectCount;
executed 13 times by 2 tests: return d->redirectCount;
Executed by:
  • tst_QNetworkReply
  • tst_qnetworkreply - unknown status
13
235}-
236-
237void QHttpNetworkRequest::setRedirectCount(int count)-
238{-
239 d->redirectCount = count;-
240}
executed 890 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
890
241-
242qint64 QHttpNetworkRequest::contentLength() const-
243{-
244 return d->contentLength();
executed 2844 times by 4 tests: return d->contentLength();
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
2844
245}-
246-
247void QHttpNetworkRequest::setContentLength(qint64 length)-
248{-
249 d->setContentLength(length);-
250}
executed 200 times by 4 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
200
251-
252QList<QPair<QByteArray, QByteArray> > QHttpNetworkRequest::header() const-
253{-
254 return d->fields;
executed 3275 times by 9 tests: return d->fields;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
3275
255}-
256-
257QByteArray QHttpNetworkRequest::headerField(const QByteArray &name, const QByteArray &defaultValue) const-
258{-
259 return d->headerField(name, defaultValue);
executed 8576 times by 9 tests: return d->headerField(name, defaultValue);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
8576
260}-
261-
262void QHttpNetworkRequest::setHeaderField(const QByteArray &name, const QByteArray &data)-
263{-
264 d->setHeaderField(name, data);-
265}
executed 8744 times by 9 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
8744
266-
267QHttpNetworkRequest &QHttpNetworkRequest::operator=(const QHttpNetworkRequest &other)-
268{-
269 d = other.d;-
270 return *this;
executed 5647 times by 9 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
5647
271}-
272-
273bool QHttpNetworkRequest::operator==(const QHttpNetworkRequest &other) const-
274{-
275 return d->operator==(*other.d);
never executed: return d->operator==(*other.d);
0
276}-
277-
278QHttpNetworkRequest::Operation QHttpNetworkRequest::operation() const-
279{-
280 return d->operation;
executed 2891 times by 8 tests: return d->operation;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qnetworkreply - unknown status
2891
281}-
282-
283void QHttpNetworkRequest::setOperation(Operation operation)-
284{-
285 d->operation = operation;-
286}
executed 887 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
887
287-
288QByteArray QHttpNetworkRequest::customVerb() const-
289{-
290 return d->customVerb;
never executed: return d->customVerb;
0
291}-
292-
293void QHttpNetworkRequest::setCustomVerb(const QByteArray &customVerb)-
294{-
295 d->customVerb = customVerb;-
296}
executed 7 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
7
297-
298QHttpNetworkRequest::Priority QHttpNetworkRequest::priority() const-
299{-
300 return d->priority;
executed 1903 times by 8 tests: return d->priority;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1903
301}-
302-
303void QHttpNetworkRequest::setPriority(Priority priority)-
304{-
305 d->priority = priority;-
306}
executed 1086 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1086
307-
308bool QHttpNetworkRequest::isPipeliningAllowed() const-
309{-
310 return d->pipeliningAllowed;
executed 3388 times by 2 tests: return d->pipeliningAllowed;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
3388
311}-
312-
313void QHttpNetworkRequest::setPipeliningAllowed(bool b)-
314{-
315 d->pipeliningAllowed = b;-
316}
executed 453 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
453
317-
318bool QHttpNetworkRequest::isSPDYAllowed() const-
319{-
320 return d->spdyAllowed;
executed 872 times by 8 tests: return d->spdyAllowed;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
872
321}-
322-
323void QHttpNetworkRequest::setSPDYAllowed(bool b)-
324{-
325 d->spdyAllowed = b;-
326}
executed 113 times by 1 test: end of block
Executed by:
  • tst_Spdy
113
327-
328bool QHttpNetworkRequest::withCredentials() const-
329{-
330 return d->withCredentials;
executed 2111 times by 9 tests: return d->withCredentials;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
2111
331}-
332-
333void QHttpNetworkRequest::setWithCredentials(bool b)-
334{-
335 d->withCredentials = b;-
336}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
1
337-
338void QHttpNetworkRequest::setUploadByteDevice(QNonContiguousByteDevice *bd)-
339{-
340 d->uploadByteDevice = bd;-
341}
executed 201 times by 4 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
201
342-
343QNonContiguousByteDevice* QHttpNetworkRequest::uploadByteDevice() const-
344{-
345 return d->uploadByteDevice;
executed 12158 times by 9 tests: return d->uploadByteDevice;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
12158
346}-
347-
348int QHttpNetworkRequest::majorVersion() const-
349{-
350 return 1;
executed 1726 times by 9 tests: return 1;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
1726
351}-
352-
353int QHttpNetworkRequest::minorVersion() const-
354{-
355 return 1;
executed 1726 times by 9 tests: return 1;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
1726
356}-
357-
358-
359QT_END_NAMESPACE-
360-
361#endif-
362-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9