| 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) 2016 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 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 The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at https://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 3 as published by the Free Software | - | ||||||||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | #include "qhttpnetworkrequest_p.h" | - | ||||||||||||||||||||||||
| 41 | #include "private/qnoncontiguousbytedevice_p.h" | - | ||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | #ifndef QT_NO_HTTP | - | ||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||
| 45 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 46 | - | |||||||||||||||||||||||||
| 47 | QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op, | - | ||||||||||||||||||||||||
| 48 | QHttpNetworkRequest::Priority pri, const QUrl &newUrl) | - | ||||||||||||||||||||||||
| 49 | : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0), | - | ||||||||||||||||||||||||
| 50 | autoDecompress(false), pipeliningAllowed(false), spdyAllowed(false), | - | ||||||||||||||||||||||||
| 51 | withCredentials(true), preConnect(false), followRedirect(false), redirectCount(0) | - | ||||||||||||||||||||||||
| 52 | { | - | ||||||||||||||||||||||||
| 53 | } executed 9653 times by 14 tests: end of blockExecuted by:
| 9653 | ||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequestPrivate &other) // = default | - | ||||||||||||||||||||||||
| 56 | : QHttpNetworkHeaderPrivate(other), | - | ||||||||||||||||||||||||
| 57 | operation(other.operation), | - | ||||||||||||||||||||||||
| 58 | customVerb(other.customVerb), | - | ||||||||||||||||||||||||
| 59 | priority(other.priority), | - | ||||||||||||||||||||||||
| 60 | uploadByteDevice(other.uploadByteDevice), | - | ||||||||||||||||||||||||
| 61 | autoDecompress(other.autoDecompress), | - | ||||||||||||||||||||||||
| 62 | pipeliningAllowed(other.pipeliningAllowed), | - | ||||||||||||||||||||||||
| 63 | spdyAllowed(other.spdyAllowed), | - | ||||||||||||||||||||||||
| 64 | withCredentials(other.withCredentials), | - | ||||||||||||||||||||||||
| 65 | ssl(other.ssl), | - | ||||||||||||||||||||||||
| 66 | preConnect(other.preConnect), | - | ||||||||||||||||||||||||
| 67 | followRedirect(other.followRedirect), | - | ||||||||||||||||||||||||
| 68 | redirectCount(other.redirectCount) | - | ||||||||||||||||||||||||
| 69 | { | - | ||||||||||||||||||||||||
| 70 | } executed 2184 times by 8 tests: end of blockExecuted by:
| 2184 | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate() | - | ||||||||||||||||||||||||
| 73 | { | - | ||||||||||||||||||||||||
| 74 | } | - | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &other) const | - | ||||||||||||||||||||||||
| 77 | { | - | ||||||||||||||||||||||||
| 78 | 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 | ||||||||||||||||||||||||
| 79 | && (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 | ||||||||||||||||||||||||
| 80 | && (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 | ||||||||||||||||||||||||
| 81 | && (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 | ||||||||||||||||||||||||
| 82 | && (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 | ||||||||||||||||||||||||
| 83 | && (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 | ||||||||||||||||||||||||
| 84 | && (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 | ||||||||||||||||||||||||
| 85 | // 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 | ||||||||||||||||||||||||
| 86 | && (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 | ||||||||||||||||||||||||
| 87 | && (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 | ||||||||||||||||||||||||
| 88 | && (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 | ||||||||||||||||||||||||
| 89 | && (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 | ||||||||||||||||||||||||
| 90 | } | - | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | QByteArray QHttpNetworkRequest::methodName() const | - | ||||||||||||||||||||||||
| 93 | { | - | ||||||||||||||||||||||||
| 94 | switch (d->operation) { | - | ||||||||||||||||||||||||
| 95 | case QHttpNetworkRequest::Get: executed 1603 times by 7 tests: case QHttpNetworkRequest::Get:Executed by:
| 1603 | ||||||||||||||||||||||||
| 96 | return "GET"; executed 1603 times by 7 tests: return "GET";Executed by:
| 1603 | ||||||||||||||||||||||||
| 97 | case QHttpNetworkRequest::Head: executed 118 times by 2 tests: case QHttpNetworkRequest::Head:Executed by:
| 118 | ||||||||||||||||||||||||
| 98 | return "HEAD"; executed 118 times by 2 tests: return "HEAD";Executed by:
| 118 | ||||||||||||||||||||||||
| 99 | case QHttpNetworkRequest::Post: executed 248 times by 4 tests: case QHttpNetworkRequest::Post:Executed by:
| 248 | ||||||||||||||||||||||||
| 100 | return "POST"; executed 248 times by 4 tests: return "POST";Executed by:
| 248 | ||||||||||||||||||||||||
| 101 | case QHttpNetworkRequest::Options: never executed: case QHttpNetworkRequest::Options: | 0 | ||||||||||||||||||||||||
| 102 | return "OPTIONS"; never executed: return "OPTIONS"; | 0 | ||||||||||||||||||||||||
| 103 | case QHttpNetworkRequest::Put: executed 38 times by 3 tests: case QHttpNetworkRequest::Put:Executed by:
| 38 | ||||||||||||||||||||||||
| 104 | return "PUT"; executed 38 times by 3 tests: return "PUT";Executed by:
| 38 | ||||||||||||||||||||||||
| 105 | case QHttpNetworkRequest::Delete: executed 7 times by 1 test: case QHttpNetworkRequest::Delete:Executed by:
| 7 | ||||||||||||||||||||||||
| 106 | return "DELETE"; executed 7 times by 1 test: return "DELETE";Executed by:
| 7 | ||||||||||||||||||||||||
| 107 | case QHttpNetworkRequest::Trace: never executed: case QHttpNetworkRequest::Trace: | 0 | ||||||||||||||||||||||||
| 108 | return "TRACE"; never executed: return "TRACE"; | 0 | ||||||||||||||||||||||||
| 109 | case QHttpNetworkRequest::Connect: never executed: case QHttpNetworkRequest::Connect: | 0 | ||||||||||||||||||||||||
| 110 | return "CONNECT"; never executed: return "CONNECT"; | 0 | ||||||||||||||||||||||||
| 111 | case QHttpNetworkRequest::Custom: executed 7 times by 1 test: case QHttpNetworkRequest::Custom:Executed by:
| 7 | ||||||||||||||||||||||||
| 112 | return d->customVerb; executed 7 times by 1 test: return d->customVerb;Executed by:
| 7 | ||||||||||||||||||||||||
| 113 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 114 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 115 | } | - | ||||||||||||||||||||||||
| 116 | return QByteArray(); never executed: return QByteArray(); | 0 | ||||||||||||||||||||||||
| 117 | } | - | ||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | QByteArray QHttpNetworkRequest::uri(bool throughProxy) const | - | ||||||||||||||||||||||||
| 120 | { | - | ||||||||||||||||||||||||
| 121 | QUrl::FormattingOptions format(QUrl::RemoveFragment | QUrl::RemoveUserInfo | QUrl::FullyEncoded); | - | ||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | // for POST, query data is sent as content | - | ||||||||||||||||||||||||
| 124 | if (d->operation == QHttpNetworkRequest::Post && !d->uploadByteDevice)
| 0-1773 | ||||||||||||||||||||||||
| 125 | format |= QUrl::RemoveQuery; never executed: format |= QUrl::RemoveQuery; | 0 | ||||||||||||||||||||||||
| 126 | // for requests through proxy, the Request-URI contains full url | - | ||||||||||||||||||||||||
| 127 | if (!throughProxy)
| 99-1922 | ||||||||||||||||||||||||
| 128 | format |= QUrl::RemoveScheme | QUrl::RemoveAuthority; executed 1922 times by 8 tests: format |= QUrl::RemoveScheme | QUrl::RemoveAuthority;Executed by:
| 1922 | ||||||||||||||||||||||||
| 129 | QUrl copy = d->url; | - | ||||||||||||||||||||||||
| 130 | if (copy.path().isEmpty())
| 253-1768 | ||||||||||||||||||||||||
| 131 | copy.setPath(QStringLiteral("/")); executed 253 times by 6 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 253 times by 6 tests: return qstring_literal_temp;Executed by:
| 253 | ||||||||||||||||||||||||
| 132 | QByteArray uri = copy.toEncoded(format); | - | ||||||||||||||||||||||||
| 133 | return uri; executed 2021 times by 8 tests: return uri;Executed by:
| 2021 | ||||||||||||||||||||||||
| 134 | } | - | ||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request, bool throughProxy) | - | ||||||||||||||||||||||||
| 137 | { | - | ||||||||||||||||||||||||
| 138 | QList<QPair<QByteArray, QByteArray> > fields = request.header(); | - | ||||||||||||||||||||||||
| 139 | QByteArray ba; | - | ||||||||||||||||||||||||
| 140 | ba.reserve(40 + fields.length()*25); // very rough lower bound estimation | - | ||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | ba += request.methodName(); | - | ||||||||||||||||||||||||
| 143 | ba += ' '; | - | ||||||||||||||||||||||||
| 144 | ba += request.uri(throughProxy); | - | ||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | ba += " HTTP/"; | - | ||||||||||||||||||||||||
| 147 | ba += QByteArray::number(request.majorVersion()); | - | ||||||||||||||||||||||||
| 148 | ba += '.'; | - | ||||||||||||||||||||||||
| 149 | ba += QByteArray::number(request.minorVersion()); | - | ||||||||||||||||||||||||
| 150 | ba += "\r\n"; | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin(); | - | ||||||||||||||||||||||||
| 153 | QList<QPair<QByteArray, QByteArray> >::const_iterator endIt = fields.constEnd(); | - | ||||||||||||||||||||||||
| 154 | for (; it != endIt; ++it) {
| 1724-9299 | ||||||||||||||||||||||||
| 155 | ba += it->first; | - | ||||||||||||||||||||||||
| 156 | ba += ": "; | - | ||||||||||||||||||||||||
| 157 | ba += it->second; | - | ||||||||||||||||||||||||
| 158 | ba += "\r\n"; | - | ||||||||||||||||||||||||
| 159 | } executed 9299 times by 8 tests: end of blockExecuted by:
| 9299 | ||||||||||||||||||||||||
| 160 | if (request.d->operation == QHttpNetworkRequest::Post) {
| 187-1537 | ||||||||||||||||||||||||
| 161 | // add content type, if not set in the request | - | ||||||||||||||||||||||||
| 162 | if (request.headerField("content-type").isEmpty() && ((request.d->uploadByteDevice && request.d->uploadByteDevice->size() > 0) || request.d->url.hasQuery())) {
| 0-185 | ||||||||||||||||||||||||
| 163 | //Content-Type is mandatory. We can't say anything about the encoding, but x-www-form-urlencoded is the most likely to work. | - | ||||||||||||||||||||||||
| 164 | //This warning indicates a bug in application code not setting a required header. | - | ||||||||||||||||||||||||
| 165 | //Note that if using QHttpMultipart, the content-type is set in QNetworkAccessManagerPrivate::prepareMultipart already | - | ||||||||||||||||||||||||
| 166 | qWarning("content-type missing in HTTP POST, defaulting to application/x-www-form-urlencoded. Use QNetworkRequest::setHeader() to fix this problem."); | - | ||||||||||||||||||||||||
| 167 | ba += "Content-Type: application/x-www-form-urlencoded\r\n"; | - | ||||||||||||||||||||||||
| 168 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 169 | if (!request.d->uploadByteDevice && request.d->url.hasQuery()) {
| 0-187 | ||||||||||||||||||||||||
| 170 | QByteArray query = request.d->url.query(QUrl::FullyEncoded).toLatin1(); | - | ||||||||||||||||||||||||
| 171 | ba += "Content-Length: "; | - | ||||||||||||||||||||||||
| 172 | ba += QByteArray::number(query.size()); | - | ||||||||||||||||||||||||
| 173 | ba += "\r\n\r\n"; | - | ||||||||||||||||||||||||
| 174 | ba += query; | - | ||||||||||||||||||||||||
| 175 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 176 | ba += "\r\n"; | - | ||||||||||||||||||||||||
| 177 | } executed 187 times by 3 tests: end of blockExecuted by:
| 187 | ||||||||||||||||||||||||
| 178 | } else { | - | ||||||||||||||||||||||||
| 179 | ba += "\r\n"; | - | ||||||||||||||||||||||||
| 180 | } executed 1537 times by 7 tests: end of blockExecuted by:
| 1537 | ||||||||||||||||||||||||
| 181 | return ba; executed 1724 times by 8 tests: return ba;Executed by:
| 1724 | ||||||||||||||||||||||||
| 182 | } | - | ||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 | // QHttpNetworkRequest | - | ||||||||||||||||||||||||
| 186 | - | |||||||||||||||||||||||||
| 187 | QHttpNetworkRequest::QHttpNetworkRequest(const QUrl &url, Operation operation, Priority priority) | - | ||||||||||||||||||||||||
| 188 | : d(new QHttpNetworkRequestPrivate(operation, priority, url)) | - | ||||||||||||||||||||||||
| 189 | { | - | ||||||||||||||||||||||||
| 190 | } executed 9653 times by 14 tests: end of blockExecuted by:
| 9653 | ||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | QHttpNetworkRequest::QHttpNetworkRequest(const QHttpNetworkRequest &other) | - | ||||||||||||||||||||||||
| 193 | : QHttpNetworkHeader(other), d(other.d) | - | ||||||||||||||||||||||||
| 194 | { | - | ||||||||||||||||||||||||
| 195 | } executed 12106 times by 8 tests: end of blockExecuted by:
| 12106 | ||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | QHttpNetworkRequest::~QHttpNetworkRequest() | - | ||||||||||||||||||||||||
| 198 | { | - | ||||||||||||||||||||||||
| 199 | } | - | ||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||
| 201 | QUrl QHttpNetworkRequest::url() const | - | ||||||||||||||||||||||||
| 202 | { | - | ||||||||||||||||||||||||
| 203 | return d->url; executed 8461 times by 8 tests: return d->url;Executed by:
| 8461 | ||||||||||||||||||||||||
| 204 | } | - | ||||||||||||||||||||||||
| 205 | void QHttpNetworkRequest::setUrl(const QUrl &url) | - | ||||||||||||||||||||||||
| 206 | { | - | ||||||||||||||||||||||||
| 207 | d->url = url; | - | ||||||||||||||||||||||||
| 208 | } executed 916 times by 8 tests: end of blockExecuted by:
| 916 | ||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | bool QHttpNetworkRequest::isSsl() const | - | ||||||||||||||||||||||||
| 211 | { | - | ||||||||||||||||||||||||
| 212 | return d->ssl; executed 1753 times by 8 tests: return d->ssl;Executed by:
| 1753 | ||||||||||||||||||||||||
| 213 | } | - | ||||||||||||||||||||||||
| 214 | void QHttpNetworkRequest::setSsl(bool s) | - | ||||||||||||||||||||||||
| 215 | { | - | ||||||||||||||||||||||||
| 216 | d->ssl = s; | - | ||||||||||||||||||||||||
| 217 | } executed 890 times by 8 tests: end of blockExecuted by:
| 890 | ||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | bool QHttpNetworkRequest::isPreConnect() const | - | ||||||||||||||||||||||||
| 220 | { | - | ||||||||||||||||||||||||
| 221 | return d->preConnect; executed 1646 times by 8 tests: return d->preConnect;Executed by:
| 1646 | ||||||||||||||||||||||||
| 222 | } | - | ||||||||||||||||||||||||
| 223 | void QHttpNetworkRequest::setPreConnect(bool preConnect) | - | ||||||||||||||||||||||||
| 224 | { | - | ||||||||||||||||||||||||
| 225 | d->preConnect = preConnect; | - | ||||||||||||||||||||||||
| 226 | } executed 890 times by 8 tests: end of blockExecuted by:
| 890 | ||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||
| 228 | bool QHttpNetworkRequest::isFollowRedirects() const | - | ||||||||||||||||||||||||
| 229 | { | - | ||||||||||||||||||||||||
| 230 | return d->followRedirect; executed 15688 times by 7 tests: return d->followRedirect;Executed by:
| 15688 | ||||||||||||||||||||||||
| 231 | } | - | ||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||
| 233 | void QHttpNetworkRequest::setFollowRedirects(bool followRedirect) | - | ||||||||||||||||||||||||
| 234 | { | - | ||||||||||||||||||||||||
| 235 | d->followRedirect = followRedirect; | - | ||||||||||||||||||||||||
| 236 | } executed 9 times by 1 test: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | int QHttpNetworkRequest::redirectCount() const | - | ||||||||||||||||||||||||
| 239 | { | - | ||||||||||||||||||||||||
| 240 | return d->redirectCount; executed 11 times by 1 test: return d->redirectCount;Executed by:
| 11 | ||||||||||||||||||||||||
| 241 | } | - | ||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||
| 243 | void QHttpNetworkRequest::setRedirectCount(int count) | - | ||||||||||||||||||||||||
| 244 | { | - | ||||||||||||||||||||||||
| 245 | d->redirectCount = count; | - | ||||||||||||||||||||||||
| 246 | } executed 890 times by 8 tests: end of blockExecuted by:
| 890 | ||||||||||||||||||||||||
| 247 | - | |||||||||||||||||||||||||
| 248 | qint64 QHttpNetworkRequest::contentLength() const | - | ||||||||||||||||||||||||
| 249 | { | - | ||||||||||||||||||||||||
| 250 | return d->contentLength(); executed 2643 times by 4 tests: return d->contentLength();Executed by:
| 2643 | ||||||||||||||||||||||||
| 251 | } | - | ||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | void QHttpNetworkRequest::setContentLength(qint64 length) | - | ||||||||||||||||||||||||
| 254 | { | - | ||||||||||||||||||||||||
| 255 | d->setContentLength(length); | - | ||||||||||||||||||||||||
| 256 | } executed 200 times by 4 tests: end of blockExecuted by:
| 200 | ||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | QList<QPair<QByteArray, QByteArray> > QHttpNetworkRequest::header() const | - | ||||||||||||||||||||||||
| 259 | { | - | ||||||||||||||||||||||||
| 260 | return d->fields; executed 3273 times by 8 tests: return d->fields;Executed by:
| 3273 | ||||||||||||||||||||||||
| 261 | } | - | ||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | QByteArray QHttpNetworkRequest::headerField(const QByteArray &name, const QByteArray &defaultValue) const | - | ||||||||||||||||||||||||
| 264 | { | - | ||||||||||||||||||||||||
| 265 | return d->headerField(name, defaultValue); executed 8571 times by 8 tests: return d->headerField(name, defaultValue);Executed by:
| 8571 | ||||||||||||||||||||||||
| 266 | } | - | ||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||
| 268 | void QHttpNetworkRequest::setHeaderField(const QByteArray &name, const QByteArray &data) | - | ||||||||||||||||||||||||
| 269 | { | - | ||||||||||||||||||||||||
| 270 | d->setHeaderField(name, data); | - | ||||||||||||||||||||||||
| 271 | } executed 8739 times by 8 tests: end of blockExecuted by:
| 8739 | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | QHttpNetworkRequest &QHttpNetworkRequest::operator=(const QHttpNetworkRequest &other) | - | ||||||||||||||||||||||||
| 274 | { | - | ||||||||||||||||||||||||
| 275 | d = other.d; | - | ||||||||||||||||||||||||
| 276 | return *this; executed 5645 times by 8 tests: return *this;Executed by:
| 5645 | ||||||||||||||||||||||||
| 277 | } | - | ||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||
| 279 | bool QHttpNetworkRequest::operator==(const QHttpNetworkRequest &other) const | - | ||||||||||||||||||||||||
| 280 | { | - | ||||||||||||||||||||||||
| 281 | return d->operator==(*other.d); never executed: return d->operator==(*other.d); | 0 | ||||||||||||||||||||||||
| 282 | } | - | ||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||
| 284 | QHttpNetworkRequest::Operation QHttpNetworkRequest::operation() const | - | ||||||||||||||||||||||||
| 285 | { | - | ||||||||||||||||||||||||
| 286 | return d->operation; executed 2721 times by 7 tests: return d->operation;Executed by:
| 2721 | ||||||||||||||||||||||||
| 287 | } | - | ||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||
| 289 | void QHttpNetworkRequest::setOperation(Operation operation) | - | ||||||||||||||||||||||||
| 290 | { | - | ||||||||||||||||||||||||
| 291 | d->operation = operation; | - | ||||||||||||||||||||||||
| 292 | } executed 887 times by 8 tests: end of blockExecuted by:
| 887 | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | QByteArray QHttpNetworkRequest::customVerb() const | - | ||||||||||||||||||||||||
| 295 | { | - | ||||||||||||||||||||||||
| 296 | return d->customVerb; never executed: return d->customVerb; | 0 | ||||||||||||||||||||||||
| 297 | } | - | ||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 | void QHttpNetworkRequest::setCustomVerb(const QByteArray &customVerb) | - | ||||||||||||||||||||||||
| 300 | { | - | ||||||||||||||||||||||||
| 301 | d->customVerb = customVerb; | - | ||||||||||||||||||||||||
| 302 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||
| 304 | QHttpNetworkRequest::Priority QHttpNetworkRequest::priority() const | - | ||||||||||||||||||||||||
| 305 | { | - | ||||||||||||||||||||||||
| 306 | return d->priority; executed 1903 times by 8 tests: return d->priority;Executed by:
| 1903 | ||||||||||||||||||||||||
| 307 | } | - | ||||||||||||||||||||||||
| 308 | - | |||||||||||||||||||||||||
| 309 | void QHttpNetworkRequest::setPriority(Priority priority) | - | ||||||||||||||||||||||||
| 310 | { | - | ||||||||||||||||||||||||
| 311 | d->priority = priority; | - | ||||||||||||||||||||||||
| 312 | } executed 1086 times by 8 tests: end of blockExecuted by:
| 1086 | ||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||
| 314 | bool QHttpNetworkRequest::isPipeliningAllowed() const | - | ||||||||||||||||||||||||
| 315 | { | - | ||||||||||||||||||||||||
| 316 | return d->pipeliningAllowed; executed 3371 times by 2 tests: return d->pipeliningAllowed;Executed by:
| 3371 | ||||||||||||||||||||||||
| 317 | } | - | ||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | void QHttpNetworkRequest::setPipeliningAllowed(bool b) | - | ||||||||||||||||||||||||
| 320 | { | - | ||||||||||||||||||||||||
| 321 | d->pipeliningAllowed = b; | - | ||||||||||||||||||||||||
| 322 | } executed 453 times by 2 tests: end of blockExecuted by:
| 453 | ||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | bool QHttpNetworkRequest::isSPDYAllowed() const | - | ||||||||||||||||||||||||
| 325 | { | - | ||||||||||||||||||||||||
| 326 | return d->spdyAllowed; executed 872 times by 8 tests: return d->spdyAllowed;Executed by:
| 872 | ||||||||||||||||||||||||
| 327 | } | - | ||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||
| 329 | void QHttpNetworkRequest::setSPDYAllowed(bool b) | - | ||||||||||||||||||||||||
| 330 | { | - | ||||||||||||||||||||||||
| 331 | d->spdyAllowed = b; | - | ||||||||||||||||||||||||
| 332 | } executed 113 times by 1 test: end of blockExecuted by:
| 113 | ||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | bool QHttpNetworkRequest::withCredentials() const | - | ||||||||||||||||||||||||
| 335 | { | - | ||||||||||||||||||||||||
| 336 | return d->withCredentials; executed 2108 times by 8 tests: return d->withCredentials;Executed by:
| 2108 | ||||||||||||||||||||||||
| 337 | } | - | ||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | void QHttpNetworkRequest::setWithCredentials(bool b) | - | ||||||||||||||||||||||||
| 340 | { | - | ||||||||||||||||||||||||
| 341 | d->withCredentials = b; | - | ||||||||||||||||||||||||
| 342 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | void QHttpNetworkRequest::setUploadByteDevice(QNonContiguousByteDevice *bd) | - | ||||||||||||||||||||||||
| 345 | { | - | ||||||||||||||||||||||||
| 346 | d->uploadByteDevice = bd; | - | ||||||||||||||||||||||||
| 347 | } executed 201 times by 4 tests: end of blockExecuted by:
| 201 | ||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | QNonContiguousByteDevice* QHttpNetworkRequest::uploadByteDevice() const | - | ||||||||||||||||||||||||
| 350 | { | - | ||||||||||||||||||||||||
| 351 | return d->uploadByteDevice; executed 12168 times by 8 tests: return d->uploadByteDevice;Executed by:
| 12168 | ||||||||||||||||||||||||
| 352 | } | - | ||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | int QHttpNetworkRequest::majorVersion() const | - | ||||||||||||||||||||||||
| 355 | { | - | ||||||||||||||||||||||||
| 356 | return 1; executed 1724 times by 8 tests: return 1;Executed by:
| 1724 | ||||||||||||||||||||||||
| 357 | } | - | ||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | int QHttpNetworkRequest::minorVersion() const | - | ||||||||||||||||||||||||
| 360 | { | - | ||||||||||||||||||||||||
| 361 | return 1; executed 1724 times by 8 tests: return 1;Executed by:
| 1724 | ||||||||||||||||||||||||
| 362 | } | - | ||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| 366 | - | |||||||||||||||||||||||||
| 367 | #endif | - | ||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |