Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpnetworkrequest.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 | - | |||||||||||||||||||||||||
39 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||
41 | QHttpNetworkRequestPrivate::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:
| 9653 | ||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||
49 | QHttpNetworkRequestPrivate::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:
| 2185 | ||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||
66 | QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate() | - | ||||||||||||||||||||||||
67 | { | - | ||||||||||||||||||||||||
68 | } | - | ||||||||||||||||||||||||
69 | - | |||||||||||||||||||||||||
70 | bool 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);
| 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);
| 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);
| 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);
| 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);
| 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);
| 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);
| 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);
| 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);
| 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);
| 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);
| 0 | ||||||||||||||||||||||||
84 | } | - | ||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||
86 | QByteArray QHttpNetworkRequest::methodName() const | - | ||||||||||||||||||||||||
87 | { | - | ||||||||||||||||||||||||
88 | switch (d->operation) { | - | ||||||||||||||||||||||||
89 | case QHttpNetworkRequest::Get: executed 1605 times by 8 tests: case QHttpNetworkRequest::Get: Executed by:
| 1605 | ||||||||||||||||||||||||
90 | return "GET"; executed 1605 times by 8 tests: return "GET"; Executed by:
| 1605 | ||||||||||||||||||||||||
91 | case QHttpNetworkRequest::Head: executed 118 times by 2 tests: case QHttpNetworkRequest::Head: Executed by:
| 118 | ||||||||||||||||||||||||
92 | return "HEAD"; executed 118 times by 2 tests: return "HEAD"; Executed by:
| 118 | ||||||||||||||||||||||||
93 | case QHttpNetworkRequest::Post: executed 248 times by 4 tests: case QHttpNetworkRequest::Post: Executed by:
| 248 | ||||||||||||||||||||||||
94 | return "POST"; executed 248 times by 4 tests: return "POST"; Executed by:
| 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:
| 38 | ||||||||||||||||||||||||
98 | return "PUT"; executed 38 times by 3 tests: return "PUT"; Executed by:
| 38 | ||||||||||||||||||||||||
99 | case QHttpNetworkRequest::Delete: executed 7 times by 1 test: case QHttpNetworkRequest::Delete: Executed by:
| 7 | ||||||||||||||||||||||||
100 | return "DELETE"; executed 7 times by 1 test: return "DELETE"; Executed by:
| 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:
| 7 | ||||||||||||||||||||||||
106 | return d->customVerb; executed 7 times by 1 test: return d->customVerb; Executed by:
| 7 | ||||||||||||||||||||||||
107 | default: never executed: default: | 0 | ||||||||||||||||||||||||
108 | break; never executed: break; | 0 | ||||||||||||||||||||||||
109 | } | - | ||||||||||||||||||||||||
110 | return QByteArray(); never executed: return QByteArray(); | 0 | ||||||||||||||||||||||||
111 | } | - | ||||||||||||||||||||||||
112 | - | |||||||||||||||||||||||||
113 | QByteArray 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)
| 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)
| 99-1924 | ||||||||||||||||||||||||
122 | format |= QUrl::RemoveScheme | QUrl::RemoveAuthority; executed 1924 times by 9 tests: format |= QUrl::RemoveScheme | QUrl::RemoveAuthority; Executed by:
| 1924 | ||||||||||||||||||||||||
123 | QUrl copy = d->url; | - | ||||||||||||||||||||||||
124 | if (copy.path().isEmpty())
| 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:
executed 255 times by 7 tests: return qstring_literal_temp; Executed by:
| 255 | ||||||||||||||||||||||||
126 | QByteArray uri = copy.toEncoded(format); | - | ||||||||||||||||||||||||
127 | return uri; executed 2023 times by 9 tests: return uri; Executed by:
| 2023 | ||||||||||||||||||||||||
128 | } | - | ||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||
130 | QByteArray 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) {
| 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:
| 9309 | ||||||||||||||||||||||||
154 | if (request.d->operation == QHttpNetworkRequest::Post) {
| 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())) {
| 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:
| 2 | ||||||||||||||||||||||||
163 | if (!request.d->uploadByteDevice && request.d->url.hasQuery()) {
| 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:
| 187 | ||||||||||||||||||||||||
172 | } else { | - | ||||||||||||||||||||||||
173 | ba += "\r\n"; | - | ||||||||||||||||||||||||
174 | } executed 1539 times by 8 tests: end of block Executed by:
| 1539 | ||||||||||||||||||||||||
175 | return ba; executed 1726 times by 9 tests: return ba; Executed by:
| 1726 | ||||||||||||||||||||||||
176 | } | - | ||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||
178 | - | |||||||||||||||||||||||||
179 | // QHttpNetworkRequest | - | ||||||||||||||||||||||||
180 | - | |||||||||||||||||||||||||
181 | QHttpNetworkRequest::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:
| 9653 | ||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||
186 | QHttpNetworkRequest::QHttpNetworkRequest(const QHttpNetworkRequest &other) | - | ||||||||||||||||||||||||
187 | : QHttpNetworkHeader(other), d(other.d) | - | ||||||||||||||||||||||||
188 | { | - | ||||||||||||||||||||||||
189 | } executed 13222 times by 9 tests: end of block Executed by:
| 13222 | ||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||
191 | QHttpNetworkRequest::~QHttpNetworkRequest() | - | ||||||||||||||||||||||||
192 | { | - | ||||||||||||||||||||||||
193 | } | - | ||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||
195 | QUrl QHttpNetworkRequest::url() const | - | ||||||||||||||||||||||||
196 | { | - | ||||||||||||||||||||||||
197 | return d->url; executed 8632 times by 9 tests: return d->url; Executed by:
| 8632 | ||||||||||||||||||||||||
198 | } | - | ||||||||||||||||||||||||
199 | void QHttpNetworkRequest::setUrl(const QUrl &url) | - | ||||||||||||||||||||||||
200 | { | - | ||||||||||||||||||||||||
201 | d->url = url; | - | ||||||||||||||||||||||||
202 | } executed 916 times by 8 tests: end of block Executed by:
| 916 | ||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||
204 | bool QHttpNetworkRequest::isSsl() const | - | ||||||||||||||||||||||||
205 | { | - | ||||||||||||||||||||||||
206 | return d->ssl; executed 1753 times by 8 tests: return d->ssl; Executed by:
| 1753 | ||||||||||||||||||||||||
207 | } | - | ||||||||||||||||||||||||
208 | void QHttpNetworkRequest::setSsl(bool s) | - | ||||||||||||||||||||||||
209 | { | - | ||||||||||||||||||||||||
210 | d->ssl = s; | - | ||||||||||||||||||||||||
211 | } executed 890 times by 8 tests: end of block Executed by:
| 890 | ||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||
213 | bool QHttpNetworkRequest::isPreConnect() const | - | ||||||||||||||||||||||||
214 | { | - | ||||||||||||||||||||||||
215 | return d->preConnect; executed 1646 times by 8 tests: return d->preConnect; Executed by:
| 1646 | ||||||||||||||||||||||||
216 | } | - | ||||||||||||||||||||||||
217 | void QHttpNetworkRequest::setPreConnect(bool preConnect) | - | ||||||||||||||||||||||||
218 | { | - | ||||||||||||||||||||||||
219 | d->preConnect = preConnect; | - | ||||||||||||||||||||||||
220 | } executed 890 times by 8 tests: end of block Executed by:
| 890 | ||||||||||||||||||||||||
221 | - | |||||||||||||||||||||||||
222 | bool QHttpNetworkRequest::isFollowRedirects() const | - | ||||||||||||||||||||||||
223 | { | - | ||||||||||||||||||||||||
224 | return d->followRedirect; executed 14417 times by 8 tests: return d->followRedirect; Executed by:
| 14417 | ||||||||||||||||||||||||
225 | } | - | ||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||
227 | void QHttpNetworkRequest::setFollowRedirects(bool followRedirect) | - | ||||||||||||||||||||||||
228 | { | - | ||||||||||||||||||||||||
229 | d->followRedirect = followRedirect; | - | ||||||||||||||||||||||||
230 | } executed 9 times by 1 test: end of block Executed by:
| 9 | ||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||
232 | int QHttpNetworkRequest::redirectCount() const | - | ||||||||||||||||||||||||
233 | { | - | ||||||||||||||||||||||||
234 | return d->redirectCount; executed 13 times by 2 tests: return d->redirectCount; Executed by:
| 13 | ||||||||||||||||||||||||
235 | } | - | ||||||||||||||||||||||||
236 | - | |||||||||||||||||||||||||
237 | void QHttpNetworkRequest::setRedirectCount(int count) | - | ||||||||||||||||||||||||
238 | { | - | ||||||||||||||||||||||||
239 | d->redirectCount = count; | - | ||||||||||||||||||||||||
240 | } executed 890 times by 8 tests: end of block Executed by:
| 890 | ||||||||||||||||||||||||
241 | - | |||||||||||||||||||||||||
242 | qint64 QHttpNetworkRequest::contentLength() const | - | ||||||||||||||||||||||||
243 | { | - | ||||||||||||||||||||||||
244 | return d->contentLength(); executed 2844 times by 4 tests: return d->contentLength(); Executed by:
| 2844 | ||||||||||||||||||||||||
245 | } | - | ||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||
247 | void QHttpNetworkRequest::setContentLength(qint64 length) | - | ||||||||||||||||||||||||
248 | { | - | ||||||||||||||||||||||||
249 | d->setContentLength(length); | - | ||||||||||||||||||||||||
250 | } executed 200 times by 4 tests: end of block Executed by:
| 200 | ||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||
252 | QList<QPair<QByteArray, QByteArray> > QHttpNetworkRequest::header() const | - | ||||||||||||||||||||||||
253 | { | - | ||||||||||||||||||||||||
254 | return d->fields; executed 3275 times by 9 tests: return d->fields; Executed by:
| 3275 | ||||||||||||||||||||||||
255 | } | - | ||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||
257 | QByteArray 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:
| 8576 | ||||||||||||||||||||||||
260 | } | - | ||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | void 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:
| 8744 | ||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | QHttpNetworkRequest &QHttpNetworkRequest::operator=(const QHttpNetworkRequest &other) | - | ||||||||||||||||||||||||
268 | { | - | ||||||||||||||||||||||||
269 | d = other.d; | - | ||||||||||||||||||||||||
270 | return *this; executed 5647 times by 9 tests: return *this; Executed by:
| 5647 | ||||||||||||||||||||||||
271 | } | - | ||||||||||||||||||||||||
272 | - | |||||||||||||||||||||||||
273 | bool QHttpNetworkRequest::operator==(const QHttpNetworkRequest &other) const | - | ||||||||||||||||||||||||
274 | { | - | ||||||||||||||||||||||||
275 | return d->operator==(*other.d); never executed: return d->operator==(*other.d); | 0 | ||||||||||||||||||||||||
276 | } | - | ||||||||||||||||||||||||
277 | - | |||||||||||||||||||||||||
278 | QHttpNetworkRequest::Operation QHttpNetworkRequest::operation() const | - | ||||||||||||||||||||||||
279 | { | - | ||||||||||||||||||||||||
280 | return d->operation; executed 2891 times by 8 tests: return d->operation; Executed by:
| 2891 | ||||||||||||||||||||||||
281 | } | - | ||||||||||||||||||||||||
282 | - | |||||||||||||||||||||||||
283 | void QHttpNetworkRequest::setOperation(Operation operation) | - | ||||||||||||||||||||||||
284 | { | - | ||||||||||||||||||||||||
285 | d->operation = operation; | - | ||||||||||||||||||||||||
286 | } executed 887 times by 8 tests: end of block Executed by:
| 887 | ||||||||||||||||||||||||
287 | - | |||||||||||||||||||||||||
288 | QByteArray QHttpNetworkRequest::customVerb() const | - | ||||||||||||||||||||||||
289 | { | - | ||||||||||||||||||||||||
290 | return d->customVerb; never executed: return d->customVerb; | 0 | ||||||||||||||||||||||||
291 | } | - | ||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||
293 | void QHttpNetworkRequest::setCustomVerb(const QByteArray &customVerb) | - | ||||||||||||||||||||||||
294 | { | - | ||||||||||||||||||||||||
295 | d->customVerb = customVerb; | - | ||||||||||||||||||||||||
296 | } executed 7 times by 1 test: end of block Executed by:
| 7 | ||||||||||||||||||||||||
297 | - | |||||||||||||||||||||||||
298 | QHttpNetworkRequest::Priority QHttpNetworkRequest::priority() const | - | ||||||||||||||||||||||||
299 | { | - | ||||||||||||||||||||||||
300 | return d->priority; executed 1903 times by 8 tests: return d->priority; Executed by:
| 1903 | ||||||||||||||||||||||||
301 | } | - | ||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||
303 | void QHttpNetworkRequest::setPriority(Priority priority) | - | ||||||||||||||||||||||||
304 | { | - | ||||||||||||||||||||||||
305 | d->priority = priority; | - | ||||||||||||||||||||||||
306 | } executed 1086 times by 8 tests: end of block Executed by:
| 1086 | ||||||||||||||||||||||||
307 | - | |||||||||||||||||||||||||
308 | bool QHttpNetworkRequest::isPipeliningAllowed() const | - | ||||||||||||||||||||||||
309 | { | - | ||||||||||||||||||||||||
310 | return d->pipeliningAllowed; executed 3388 times by 2 tests: return d->pipeliningAllowed; Executed by:
| 3388 | ||||||||||||||||||||||||
311 | } | - | ||||||||||||||||||||||||
312 | - | |||||||||||||||||||||||||
313 | void QHttpNetworkRequest::setPipeliningAllowed(bool b) | - | ||||||||||||||||||||||||
314 | { | - | ||||||||||||||||||||||||
315 | d->pipeliningAllowed = b; | - | ||||||||||||||||||||||||
316 | } executed 453 times by 2 tests: end of block Executed by:
| 453 | ||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||
318 | bool QHttpNetworkRequest::isSPDYAllowed() const | - | ||||||||||||||||||||||||
319 | { | - | ||||||||||||||||||||||||
320 | return d->spdyAllowed; executed 872 times by 8 tests: return d->spdyAllowed; Executed by:
| 872 | ||||||||||||||||||||||||
321 | } | - | ||||||||||||||||||||||||
322 | - | |||||||||||||||||||||||||
323 | void QHttpNetworkRequest::setSPDYAllowed(bool b) | - | ||||||||||||||||||||||||
324 | { | - | ||||||||||||||||||||||||
325 | d->spdyAllowed = b; | - | ||||||||||||||||||||||||
326 | } executed 113 times by 1 test: end of block Executed by:
| 113 | ||||||||||||||||||||||||
327 | - | |||||||||||||||||||||||||
328 | bool QHttpNetworkRequest::withCredentials() const | - | ||||||||||||||||||||||||
329 | { | - | ||||||||||||||||||||||||
330 | return d->withCredentials; executed 2111 times by 9 tests: return d->withCredentials; Executed by:
| 2111 | ||||||||||||||||||||||||
331 | } | - | ||||||||||||||||||||||||
332 | - | |||||||||||||||||||||||||
333 | void QHttpNetworkRequest::setWithCredentials(bool b) | - | ||||||||||||||||||||||||
334 | { | - | ||||||||||||||||||||||||
335 | d->withCredentials = b; | - | ||||||||||||||||||||||||
336 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
337 | - | |||||||||||||||||||||||||
338 | void QHttpNetworkRequest::setUploadByteDevice(QNonContiguousByteDevice *bd) | - | ||||||||||||||||||||||||
339 | { | - | ||||||||||||||||||||||||
340 | d->uploadByteDevice = bd; | - | ||||||||||||||||||||||||
341 | } executed 201 times by 4 tests: end of block Executed by:
| 201 | ||||||||||||||||||||||||
342 | - | |||||||||||||||||||||||||
343 | QNonContiguousByteDevice* QHttpNetworkRequest::uploadByteDevice() const | - | ||||||||||||||||||||||||
344 | { | - | ||||||||||||||||||||||||
345 | return d->uploadByteDevice; executed 12158 times by 9 tests: return d->uploadByteDevice; Executed by:
| 12158 | ||||||||||||||||||||||||
346 | } | - | ||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||
348 | int QHttpNetworkRequest::majorVersion() const | - | ||||||||||||||||||||||||
349 | { | - | ||||||||||||||||||||||||
350 | return 1; executed 1726 times by 9 tests: return 1; Executed by:
| 1726 | ||||||||||||||||||||||||
351 | } | - | ||||||||||||||||||||||||
352 | - | |||||||||||||||||||||||||
353 | int QHttpNetworkRequest::minorVersion() const | - | ||||||||||||||||||||||||
354 | { | - | ||||||||||||||||||||||||
355 | return 1; executed 1726 times by 9 tests: return 1; Executed by:
| 1726 | ||||||||||||||||||||||||
356 | } | - | ||||||||||||||||||||||||
357 | - | |||||||||||||||||||||||||
358 | - | |||||||||||||||||||||||||
359 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
360 | - | |||||||||||||||||||||||||
361 | #endif | - | ||||||||||||||||||||||||
362 | - | |||||||||||||||||||||||||
Source code | Switch to Preprocessed file |