| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qnetworkrequest.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | class QNetworkRequestPrivate: public QSharedData, public QNetworkHeadersPrivate | - | ||||||||||||||||||
| 9 | { | - | ||||||||||||||||||
| 10 | public: | - | ||||||||||||||||||
| 11 | static const int maxRedirectCount = 50; | - | ||||||||||||||||||
| 12 | inline QNetworkRequestPrivate() | - | ||||||||||||||||||
| 13 | : priority(QNetworkRequest::NormalPriority) | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | , sslConfiguration(0) | - | ||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | , maxRedirectsAllowed(maxRedirectCount) | - | ||||||||||||||||||
| 18 | { qRegisterMetaType<QNetworkRequest>(); } executed 3129 times by 11 tests:  end of blockExecuted by: 
 | 3129 | ||||||||||||||||||
| 19 | ~QNetworkRequestPrivate() | - | ||||||||||||||||||
| 20 | { | - | ||||||||||||||||||
| 21 | - | |||||||||||||||||||
| 22 | delete sslConfiguration; | - | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | } executed 3384 times by 12 tests:  end of blockExecuted by: 
 | 3384 | ||||||||||||||||||
| 25 | - | |||||||||||||||||||
| 26 | - | |||||||||||||||||||
| 27 | QNetworkRequestPrivate(const QNetworkRequestPrivate &other) | - | ||||||||||||||||||
| 28 | : QSharedData(other), QNetworkHeadersPrivate(other) | - | ||||||||||||||||||
| 29 | { | - | ||||||||||||||||||
| 30 | url = other.url; | - | ||||||||||||||||||
| 31 | priority = other.priority; | - | ||||||||||||||||||
| 32 | maxRedirectsAllowed = other.maxRedirectsAllowed; | - | ||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | sslConfiguration = 0; | - | ||||||||||||||||||
| 35 | if (other.sslConfiguration 
 | 102-154 | ||||||||||||||||||
| 36 | sslConfiguration = new QSslConfiguration(*other.sslConfiguration); executed 102 times by 2 tests:  sslConfiguration = new QSslConfiguration(*other.sslConfiguration);Executed by: 
 | 102 | ||||||||||||||||||
| 37 | - | |||||||||||||||||||
| 38 | } executed 256 times by 3 tests:  end of blockExecuted by: 
 | 256 | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | inline bool operator==(const QNetworkRequestPrivate &other) const | - | ||||||||||||||||||
| 41 | { | - | ||||||||||||||||||
| 42 | return never executed: url == other.url return url == other.url && priority == other.priority && rawHeaders == other.rawHeaders && attributes == other.attributes && maxRedirectsAllowed == other.maxRedirectsAllowed;
 never executed:  return url == other.url && priority == other.priority && rawHeaders == other.rawHeaders && attributes == other.attributes && maxRedirectsAllowed == other.maxRedirectsAllowed; | 0 | ||||||||||||||||||
| 43 | priority == other.priority 
 never executed:  return url == other.url && priority == other.priority && rawHeaders == other.rawHeaders && attributes == other.attributes && maxRedirectsAllowed == other.maxRedirectsAllowed; | 0 | ||||||||||||||||||
| 44 | rawHeaders == other.rawHeaders 
 never executed:  return url == other.url && priority == other.priority && rawHeaders == other.rawHeaders && attributes == other.attributes && maxRedirectsAllowed == other.maxRedirectsAllowed; | 0 | ||||||||||||||||||
| 45 | attributes == other.attributes 
 never executed:  return url == other.url && priority == other.priority && rawHeaders == other.rawHeaders && attributes == other.attributes && maxRedirectsAllowed == other.maxRedirectsAllowed; | 0 | ||||||||||||||||||
| 46 | maxRedirectsAllowed == other.maxRedirectsAllowed 
 never executed:  return url == other.url && priority == other.priority && rawHeaders == other.rawHeaders && attributes == other.attributes && maxRedirectsAllowed == other.maxRedirectsAllowed; | 0 | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | } | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | QUrl url; | - | ||||||||||||||||||
| 51 | QNetworkRequest::Priority priority; | - | ||||||||||||||||||
| 52 | - | |||||||||||||||||||
| 53 | mutable QSslConfiguration *sslConfiguration; | - | ||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | int maxRedirectsAllowed; | - | ||||||||||||||||||
| 56 | }; | - | ||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | - | |||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | - | |||||||||||||||||||
| 63 | - | |||||||||||||||||||
| 64 | QNetworkRequest::QNetworkRequest(const QUrl &url) | - | ||||||||||||||||||
| 65 | : d(new QNetworkRequestPrivate) | - | ||||||||||||||||||
| 66 | { | - | ||||||||||||||||||
| 67 | d->url = url; | - | ||||||||||||||||||
| 68 | } executed 3129 times by 11 tests:  end of blockExecuted by: 
 | 3129 | ||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | QNetworkRequest::QNetworkRequest(const QNetworkRequest &other) | - | ||||||||||||||||||
| 74 | : d(other.d) | - | ||||||||||||||||||
| 75 | { | - | ||||||||||||||||||
| 76 | } executed 1181 times by 8 tests:  end of blockExecuted by: 
 | 1181 | ||||||||||||||||||
| 77 | - | |||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | - | |||||||||||||||||||
| 80 | - | |||||||||||||||||||
| 81 | QNetworkRequest::~QNetworkRequest() | - | ||||||||||||||||||
| 82 | { | - | ||||||||||||||||||
| 83 | - | |||||||||||||||||||
| 84 | d = 0; | - | ||||||||||||||||||
| 85 | } executed 4307 times by 12 tests:  end of blockExecuted by: 
 | 4307 | ||||||||||||||||||
| 86 | - | |||||||||||||||||||
| 87 | - | |||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | - | |||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | - | |||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | bool QNetworkRequest::operator==(const QNetworkRequest &other) const | - | ||||||||||||||||||
| 94 | { | - | ||||||||||||||||||
| 95 | return executed 1 time by 1 test: d == other.d return d == other.d || *d == *other.d;Executed by: 
 
 
 
 executed 1 time by 1 test:  return d == other.d || *d == *other.d;Executed by: 
 | 0-1 | ||||||||||||||||||
| 96 | } | - | ||||||||||||||||||
| 97 | QNetworkRequest &QNetworkRequest::operator=(const QNetworkRequest &other) | - | ||||||||||||||||||
| 98 | { | - | ||||||||||||||||||
| 99 | d = other.d; | - | ||||||||||||||||||
| 100 | return executed 1956 times by 10 tests: *this; return *this;Executed by: 
 executed 1956 times by 10 tests:  return *this;Executed by: 
 | 1956 | ||||||||||||||||||
| 101 | } | - | ||||||||||||||||||
| 102 | QUrl QNetworkRequest::url() const | - | ||||||||||||||||||
| 103 | { | - | ||||||||||||||||||
| 104 | return executed 6076 times by 11 tests: d->url; return d->url;Executed by: 
 executed 6076 times by 11 tests:  return d->url;Executed by: 
 | 6076 | ||||||||||||||||||
| 105 | } | - | ||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | - | |||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | void QNetworkRequest::setUrl(const QUrl &url) | - | ||||||||||||||||||
| 113 | { | - | ||||||||||||||||||
| 114 | d->url = url; | - | ||||||||||||||||||
| 115 | } executed 29 times by 2 tests:  end of blockExecuted by: 
 | 29 | ||||||||||||||||||
| 116 | QVariant QNetworkRequest::header(KnownHeaders header) const | - | ||||||||||||||||||
| 117 | { | - | ||||||||||||||||||
| 118 | return executed 1084 times by 9 tests: d->cookedHeaders.value(header); return d->cookedHeaders.value(header);Executed by: 
 executed 1084 times by 9 tests:  return d->cookedHeaders.value(header);Executed by: 
 | 1084 | ||||||||||||||||||
| 119 | } | - | ||||||||||||||||||
| 120 | void QNetworkRequest::setHeader(KnownHeaders header, const QVariant &value) | - | ||||||||||||||||||
| 121 | { | - | ||||||||||||||||||
| 122 | d->setCookedHeader(header, value); | - | ||||||||||||||||||
| 123 | } executed 212 times by 4 tests:  end of blockExecuted by: 
 | 212 | ||||||||||||||||||
| 124 | - | |||||||||||||||||||
| 125 | - | |||||||||||||||||||
| 126 | - | |||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | bool QNetworkRequest::hasRawHeader(const QByteArray &headerName) const | - | ||||||||||||||||||
| 132 | { | - | ||||||||||||||||||
| 133 | return executed 768 times by 8 tests: d->findRawHeader(headerName) != d->rawHeaders.constEnd(); return d->findRawHeader(headerName) != d->rawHeaders.constEnd();Executed by: 
 executed 768 times by 8 tests:  return d->findRawHeader(headerName) != d->rawHeaders.constEnd();Executed by: 
 | 768 | ||||||||||||||||||
| 134 | } | - | ||||||||||||||||||
| 135 | QByteArray QNetworkRequest::rawHeader(const QByteArray &headerName) const | - | ||||||||||||||||||
| 136 | { | - | ||||||||||||||||||
| 137 | QNetworkHeadersPrivate::RawHeadersList::ConstIterator it = | - | ||||||||||||||||||
| 138 | d->findRawHeader(headerName); | - | ||||||||||||||||||
| 139 | if (it != d->rawHeaders.constEnd() 
 | 4-376 | ||||||||||||||||||
| 140 | return executed 376 times by 4 tests: it->second; return it->second;Executed by: 
 executed 376 times by 4 tests:  return it->second;Executed by: 
 | 376 | ||||||||||||||||||
| 141 | return executed 4 times by 1 test: QByteArray(); return QByteArray();Executed by: 
 executed 4 times by 1 test:  return QByteArray();Executed by: 
 | 4 | ||||||||||||||||||
| 142 | } | - | ||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | - | |||||||||||||||||||
| 146 | - | |||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | QList<QByteArray> QNetworkRequest::rawHeaderList() const | - | ||||||||||||||||||
| 151 | { | - | ||||||||||||||||||
| 152 | return executed 886 times by 9 tests: d->rawHeadersKeys(); return d->rawHeadersKeys();Executed by: 
 executed 886 times by 9 tests:  return d->rawHeadersKeys();Executed by: 
 | 886 | ||||||||||||||||||
| 153 | } | - | ||||||||||||||||||
| 154 | void QNetworkRequest::setRawHeader(const QByteArray &headerName, const QByteArray &headerValue) | - | ||||||||||||||||||
| 155 | { | - | ||||||||||||||||||
| 156 | d->setRawHeader(headerName, headerValue); | - | ||||||||||||||||||
| 157 | } executed 198 times by 4 tests:  end of blockExecuted by: 
 | 198 | ||||||||||||||||||
| 158 | QVariant QNetworkRequest::attribute(Attribute code, const QVariant &defaultValue) const | - | ||||||||||||||||||
| 159 | { | - | ||||||||||||||||||
| 160 | return executed 10121 times by 9 tests: d->attributes.value(code, defaultValue); return d->attributes.value(code, defaultValue);Executed by: 
 executed 10121 times by 9 tests:  return d->attributes.value(code, defaultValue);Executed by: 
 | 10121 | ||||||||||||||||||
| 161 | } | - | ||||||||||||||||||
| 162 | void QNetworkRequest::setAttribute(Attribute code, const QVariant &value) | - | ||||||||||||||||||
| 163 | { | - | ||||||||||||||||||
| 164 | if (value.isValid() 
 | 0-334 | ||||||||||||||||||
| 165 | d->attributes.insert(code, value); executed 334 times by 5 tests:  d->attributes.insert(code, value);Executed by: 
 | 334 | ||||||||||||||||||
| 166 | else | - | ||||||||||||||||||
| 167 | d->attributes.remove(code); never executed:  d->attributes.remove(code); | 0 | ||||||||||||||||||
| 168 | } | - | ||||||||||||||||||
| 169 | QSslConfiguration QNetworkRequest::sslConfiguration() const | - | ||||||||||||||||||
| 170 | { | - | ||||||||||||||||||
| 171 | if (!d->sslConfiguration 
 | 411-814 | ||||||||||||||||||
| 172 | d->sslConfiguration = new QSslConfiguration(QSslConfiguration::defaultConfiguration()); executed 814 times by 8 tests:  d->sslConfiguration = new QSslConfiguration(QSslConfiguration::defaultConfiguration());Executed by: 
 | 814 | ||||||||||||||||||
| 173 | return executed 1225 times by 8 tests: *d->sslConfiguration; return *d->sslConfiguration;Executed by: 
 executed 1225 times by 8 tests:  return *d->sslConfiguration;Executed by: 
 | 1225 | ||||||||||||||||||
| 174 | } | - | ||||||||||||||||||
| 175 | void QNetworkRequest::setSslConfiguration(const QSslConfiguration &config) | - | ||||||||||||||||||
| 176 | { | - | ||||||||||||||||||
| 177 | if (!d->sslConfiguration 
 | 1-46 | ||||||||||||||||||
| 178 | d->sslConfiguration = new QSslConfiguration(config); executed 46 times by 1 test:  d->sslConfiguration = new QSslConfiguration(config);Executed by: 
 | 46 | ||||||||||||||||||
| 179 | else | - | ||||||||||||||||||
| 180 | * executed 1 time by 1 test: d->sslConfiguration = config; *d->sslConfiguration = config;Executed by: 
 executed 1 time by 1 test:  *d->sslConfiguration = config;Executed by: 
 | 1 | ||||||||||||||||||
| 181 | } | - | ||||||||||||||||||
| 182 | void QNetworkRequest::setOriginatingObject(QObject *object) | - | ||||||||||||||||||
| 183 | { | - | ||||||||||||||||||
| 184 | d->originatingObject = object; | - | ||||||||||||||||||
| 185 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 186 | QObject *QNetworkRequest::originatingObject() const | - | ||||||||||||||||||
| 187 | { | - | ||||||||||||||||||
| 188 | return executed 3 times by 1 test: d->originatingObject.data(); return d->originatingObject.data();Executed by: 
 executed 3 times by 1 test:  return d->originatingObject.data();Executed by: 
 | 3 | ||||||||||||||||||
| 189 | } | - | ||||||||||||||||||
| 190 | QNetworkRequest::Priority QNetworkRequest::priority() const | - | ||||||||||||||||||
| 191 | { | - | ||||||||||||||||||
| 192 | return executed 887 times by 8 tests: d->priority; return d->priority;Executed by: 
 executed 887 times by 8 tests:  return d->priority;Executed by: 
 | 887 | ||||||||||||||||||
| 193 | } | - | ||||||||||||||||||
| 194 | void QNetworkRequest::setPriority(Priority priority) | - | ||||||||||||||||||
| 195 | { | - | ||||||||||||||||||
| 196 | d->priority = priority; | - | ||||||||||||||||||
| 197 | } never executed:  end of block | 0 | ||||||||||||||||||
| 198 | int QNetworkRequest::maximumRedirectsAllowed() const | - | ||||||||||||||||||
| 199 | { | - | ||||||||||||||||||
| 200 | return executed 891 times by 8 tests: d->maxRedirectsAllowed; return d->maxRedirectsAllowed;Executed by: 
 executed 891 times by 8 tests:  return d->maxRedirectsAllowed;Executed by: 
 | 891 | ||||||||||||||||||
| 201 | } | - | ||||||||||||||||||
| 202 | void QNetworkRequest::setMaximumRedirectsAllowed(int maxRedirectsAllowed) | - | ||||||||||||||||||
| 203 | { | - | ||||||||||||||||||
| 204 | d->maxRedirectsAllowed = maxRedirectsAllowed; | - | ||||||||||||||||||
| 205 | } executed 7 times by 1 test:  end of blockExecuted by: 
 | 7 | ||||||||||||||||||
| 206 | - | |||||||||||||||||||
| 207 | static QByteArray headerName(QNetworkRequest::KnownHeaders header) | - | ||||||||||||||||||
| 208 | { | - | ||||||||||||||||||
| 209 | switch (header) { | - | ||||||||||||||||||
| 210 | case executed 94 times by 4 tests: QNetworkRequest::ContentTypeHeader: case QNetworkRequest::ContentTypeHeader:Executed by: 
 executed 94 times by 4 tests:  case QNetworkRequest::ContentTypeHeader:Executed by: 
 | 94 | ||||||||||||||||||
| 211 | return executed 94 times by 4 tests: "Content-Type"; return "Content-Type";Executed by: 
 executed 94 times by 4 tests:  return "Content-Type";Executed by: 
 | 94 | ||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | case executed 252 times by 5 tests: QNetworkRequest::ContentLengthHeader: case QNetworkRequest::ContentLengthHeader:Executed by: 
 executed 252 times by 5 tests:  case QNetworkRequest::ContentLengthHeader:Executed by: 
 | 252 | ||||||||||||||||||
| 214 | return executed 252 times by 5 tests: "Content-Length"; return "Content-Length";Executed by: 
 executed 252 times by 5 tests:  return "Content-Length";Executed by: 
 | 252 | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | case executed 3 times by 1 test: QNetworkRequest::LocationHeader: case QNetworkRequest::LocationHeader:Executed by: 
 executed 3 times by 1 test:  case QNetworkRequest::LocationHeader:Executed by: 
 | 3 | ||||||||||||||||||
| 217 | return executed 3 times by 1 test: "Location"; return "Location";Executed by: 
 executed 3 times by 1 test:  return "Location";Executed by: 
 | 3 | ||||||||||||||||||
| 218 | - | |||||||||||||||||||
| 219 | case executed 59 times by 3 tests: QNetworkRequest::LastModifiedHeader: case QNetworkRequest::LastModifiedHeader:Executed by: 
 executed 59 times by 3 tests:  case QNetworkRequest::LastModifiedHeader:Executed by: 
 | 59 | ||||||||||||||||||
| 220 | return executed 59 times by 3 tests: "Last-Modified"; return "Last-Modified";Executed by: 
 executed 59 times by 3 tests:  return "Last-Modified";Executed by: 
 | 59 | ||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | case executed 11 times by 2 tests: QNetworkRequest::CookieHeader: case QNetworkRequest::CookieHeader:Executed by: 
 executed 11 times by 2 tests:  case QNetworkRequest::CookieHeader:Executed by: 
 | 11 | ||||||||||||||||||
| 223 | return executed 11 times by 2 tests: "Cookie"; return "Cookie";Executed by: 
 executed 11 times by 2 tests:  return "Cookie";Executed by: 
 | 11 | ||||||||||||||||||
| 224 | - | |||||||||||||||||||
| 225 | case executed 3 times by 1 test: QNetworkRequest::SetCookieHeader: case QNetworkRequest::SetCookieHeader:Executed by: 
 executed 3 times by 1 test:  case QNetworkRequest::SetCookieHeader:Executed by: 
 | 3 | ||||||||||||||||||
| 226 | return executed 3 times by 1 test: "Set-Cookie"; return "Set-Cookie";Executed by: 
 executed 3 times by 1 test:  return "Set-Cookie";Executed by: 
 | 3 | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | case executed 36 times by 2 tests: QNetworkRequest::ContentDispositionHeader: case QNetworkRequest::ContentDispositionHeader:Executed by: 
 executed 36 times by 2 tests:  case QNetworkRequest::ContentDispositionHeader:Executed by: 
 | 36 | ||||||||||||||||||
| 229 | return executed 36 times by 2 tests: "Content-Disposition"; return "Content-Disposition";Executed by: 
 executed 36 times by 2 tests:  return "Content-Disposition";Executed by: 
 | 36 | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | case executed 1 time by 1 test: QNetworkRequest::UserAgentHeader: case QNetworkRequest::UserAgentHeader:Executed by: 
 executed 1 time by 1 test:  case QNetworkRequest::UserAgentHeader:Executed by: 
 | 1 | ||||||||||||||||||
| 232 | return executed 1 time by 1 test: "User-Agent"; return "User-Agent";Executed by: 
 executed 1 time by 1 test:  return "User-Agent";Executed by: 
 | 1 | ||||||||||||||||||
| 233 | - | |||||||||||||||||||
| 234 | case never executed: QNetworkRequest::ServerHeader: case QNetworkRequest::ServerHeader:never executed:  case QNetworkRequest::ServerHeader: | 0 | ||||||||||||||||||
| 235 | return never executed: "Server"; return "Server";never executed:  return "Server"; | 0 | ||||||||||||||||||
| 236 | - | |||||||||||||||||||
| 237 | - | |||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | } | - | ||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | return never executed: QByteArray(); return QByteArray();never executed:  return QByteArray(); | 0 | ||||||||||||||||||
| 242 | } | - | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVariant &value) | - | ||||||||||||||||||
| 245 | { | - | ||||||||||||||||||
| 246 | switch (header) { | - | ||||||||||||||||||
| 247 | case executed 93 times by 4 tests: QNetworkRequest::ContentTypeHeader: case QNetworkRequest::ContentTypeHeader:Executed by: 
 executed 93 times by 4 tests:  case QNetworkRequest::ContentTypeHeader:Executed by: 
 | 93 | ||||||||||||||||||
| 248 | case executed 251 times by 5 tests: QNetworkRequest::ContentLengthHeader: case QNetworkRequest::ContentLengthHeader:Executed by: 
 executed 251 times by 5 tests:  case QNetworkRequest::ContentLengthHeader:Executed by: 
 | 251 | ||||||||||||||||||
| 249 | case executed 36 times by 2 tests: QNetworkRequest::ContentDispositionHeader: case QNetworkRequest::ContentDispositionHeader:Executed by: 
 executed 36 times by 2 tests:  case QNetworkRequest::ContentDispositionHeader:Executed by: 
 | 36 | ||||||||||||||||||
| 250 | case executed 1 time by 1 test: QNetworkRequest::UserAgentHeader: case QNetworkRequest::UserAgentHeader:Executed by: 
 executed 1 time by 1 test:  case QNetworkRequest::UserAgentHeader:Executed by: 
 | 1 | ||||||||||||||||||
| 251 | case never executed: QNetworkRequest::ServerHeader: case QNetworkRequest::ServerHeader:never executed:  case QNetworkRequest::ServerHeader: | 0 | ||||||||||||||||||
| 252 | return executed 381 times by 5 tests: value.toByteArray(); return value.toByteArray();Executed by: 
 executed 381 times by 5 tests:  return value.toByteArray();Executed by: 
 | 381 | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | case executed 3 times by 1 test: QNetworkRequest::LocationHeader: case QNetworkRequest::LocationHeader:Executed by: 
 executed 3 times by 1 test:  case QNetworkRequest::LocationHeader:Executed by: 
 | 3 | ||||||||||||||||||
| 255 | switch (value.userType()) { | - | ||||||||||||||||||
| 256 | case executed 1 time by 1 test: QMetaType::QUrl: case QMetaType::QUrl:Executed by: 
 executed 1 time by 1 test:  case QMetaType::QUrl:Executed by: 
 | 1 | ||||||||||||||||||
| 257 | return executed 1 time by 1 test: value.toUrl().toEncoded(); return value.toUrl().toEncoded();Executed by: 
 executed 1 time by 1 test:  return value.toUrl().toEncoded();Executed by: 
 | 1 | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | default executed 2 times by 1 test: : default:Executed by: 
 executed 2 times by 1 test:  default:Executed by: 
 | 2 | ||||||||||||||||||
| 260 | return executed 2 times by 1 test: value.toByteArray(); return value.toByteArray();Executed by: 
 executed 2 times by 1 test:  return value.toByteArray();Executed by: 
 | 2 | ||||||||||||||||||
| 261 | } | - | ||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | case executed 57 times by 3 tests: QNetworkRequest::LastModifiedHeader: case QNetworkRequest::LastModifiedHeader:Executed by: 
 executed 57 times by 3 tests:  case QNetworkRequest::LastModifiedHeader:Executed by: 
 | 57 | ||||||||||||||||||
| 264 | switch (value.userType()) { | - | ||||||||||||||||||
| 265 | case executed 1 time by 1 test: QMetaType::QDate: case QMetaType::QDate:Executed by: 
 executed 1 time by 1 test:  case QMetaType::QDate:Executed by: 
 | 1 | ||||||||||||||||||
| 266 | case executed 56 times by 3 tests: QMetaType::QDateTime: case QMetaType::QDateTime:Executed by: 
 executed 56 times by 3 tests:  case QMetaType::QDateTime:Executed by: 
 | 56 | ||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | return executed 57 times by 3 tests: QNetworkHeadersPrivate::toHttpDate(value.toDateTime()); return QNetworkHeadersPrivate::toHttpDate(value.toDateTime());Executed by: 
 executed 57 times by 3 tests:  return QNetworkHeadersPrivate::toHttpDate(value.toDateTime());Executed by: 
 | 57 | ||||||||||||||||||
| 269 | - | |||||||||||||||||||
| 270 | default never executed: : default:never executed:  default: | 0 | ||||||||||||||||||
| 271 | return never executed: value.toByteArray(); return value.toByteArray();never executed:  return value.toByteArray(); | 0 | ||||||||||||||||||
| 272 | } | - | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | case executed 11 times by 2 tests: QNetworkRequest::CookieHeader: case QNetworkRequest::CookieHeader:Executed by: 
 executed 11 times by 2 tests: { case QNetworkRequest::CookieHeader:Executed by: 
 | 11 | ||||||||||||||||||
| 275 | QList<QNetworkCookie> cookies = qvariant_cast<QList<QNetworkCookie> >(value); | - | ||||||||||||||||||
| 276 | if (cookies.isEmpty() 
 
 | 0-11 | ||||||||||||||||||
| 277 | cookies << qvariant_cast<QNetworkCookie>(value); never executed:  cookies << qvariant_cast<QNetworkCookie>(value); | 0 | ||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | QByteArray result; | - | ||||||||||||||||||
| 280 | bool first = true; | - | ||||||||||||||||||
| 281 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cookies)>::type> _container_((cookies)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QNetworkCookie &cookie = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
| 282 | if (!first 
 | 3-11 | ||||||||||||||||||
| 283 | result += "; "; executed 3 times by 2 tests:  result += "; ";Executed by: 
 | 3 | ||||||||||||||||||
| 284 | first = false; | - | ||||||||||||||||||
| 285 | result += cookie.toRawForm(QNetworkCookie::NameAndValueOnly); | - | ||||||||||||||||||
| 286 | } executed 14 times by 2 tests:  end of blockExecuted by: 
 | 14 | ||||||||||||||||||
| 287 | return executed 11 times by 2 tests: result; return result;Executed by: 
 executed 11 times by 2 tests:  return result;Executed by: 
 | 11 | ||||||||||||||||||
| 288 | } | - | ||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | case executed 3 times by 1 test: QNetworkRequest::SetCookieHeader: case QNetworkRequest::SetCookieHeader:Executed by: 
 executed 3 times by 1 test: { case QNetworkRequest::SetCookieHeader:Executed by: 
 | 3 | ||||||||||||||||||
| 291 | QList<QNetworkCookie> cookies = qvariant_cast<QList<QNetworkCookie> >(value); | - | ||||||||||||||||||
| 292 | if (cookies.isEmpty() 
 
 | 0-3 | ||||||||||||||||||
| 293 | cookies << qvariant_cast<QNetworkCookie>(value); never executed:  cookies << qvariant_cast<QNetworkCookie>(value); | 0 | ||||||||||||||||||
| 294 | - | |||||||||||||||||||
| 295 | QByteArray result; | - | ||||||||||||||||||
| 296 | bool first = true; | - | ||||||||||||||||||
| 297 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cookies)>::type> _container_((cookies)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QNetworkCookie &cookie = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
| 298 | if (!first 
 | 1-3 | ||||||||||||||||||
| 299 | result += ", "; executed 1 time by 1 test:  result += ", ";Executed by: 
 | 1 | ||||||||||||||||||
| 300 | first = false; | - | ||||||||||||||||||
| 301 | result += cookie.toRawForm(QNetworkCookie::Full); | - | ||||||||||||||||||
| 302 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 303 | return executed 3 times by 1 test: result; return result;Executed by: 
 executed 3 times by 1 test:  return result;Executed by: 
 | 3 | ||||||||||||||||||
| 304 | } | - | ||||||||||||||||||
| 305 | } | - | ||||||||||||||||||
| 306 | - | |||||||||||||||||||
| 307 | return never executed: QByteArray(); return QByteArray();never executed:  return QByteArray(); | 0 | ||||||||||||||||||
| 308 | } | - | ||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | static int parseHeaderName(const QByteArray &headerName) | - | ||||||||||||||||||
| 311 | { | - | ||||||||||||||||||
| 312 | if (headerName.isEmpty() 
 | 0-5856 | ||||||||||||||||||
| 313 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||
| 314 | - | |||||||||||||||||||
| 315 | switch (tolower(headerName.at(0))) { | - | ||||||||||||||||||
| 316 | case executed 2183 times by 7 tests: 'c': case 'c':Executed by: 
 executed 2183 times by 7 tests:  case 'c':Executed by: 
 | 2183 | ||||||||||||||||||
| 317 | if (qstricmp(headerName.constData(), "content-type") == 0 
 | 917-1266 | ||||||||||||||||||
| 318 | return executed 917 times by 6 tests: QNetworkRequest::ContentTypeHeader; return QNetworkRequest::ContentTypeHeader;Executed by: 
 executed 917 times by 6 tests:  return QNetworkRequest::ContentTypeHeader;Executed by: 
 | 917 | ||||||||||||||||||
| 319 | else if (qstricmp(headerName.constData(), "content-length") == 0 
 | 590-676 | ||||||||||||||||||
| 320 | return executed 590 times by 7 tests: QNetworkRequest::ContentLengthHeader; return QNetworkRequest::ContentLengthHeader;Executed by: 
 executed 590 times by 7 tests:  return QNetworkRequest::ContentLengthHeader;Executed by: 
 | 590 | ||||||||||||||||||
| 321 | else if (qstricmp(headerName.constData(), "cookie") == 0 
 | 2-674 | ||||||||||||||||||
| 322 | return executed 2 times by 1 test: QNetworkRequest::CookieHeader; return QNetworkRequest::CookieHeader;Executed by: 
 executed 2 times by 1 test:  return QNetworkRequest::CookieHeader;Executed by: 
 | 2 | ||||||||||||||||||
| 323 | break; executed 674 times by 6 tests:  break;Executed by: 
 | 674 | ||||||||||||||||||
| 324 | - | |||||||||||||||||||
| 325 | case executed 360 times by 6 tests: 'l': case 'l':Executed by: 
 executed 360 times by 6 tests:  case 'l':Executed by: 
 | 360 | ||||||||||||||||||
| 326 | if (qstricmp(headerName.constData(), "location") == 0 
 | 47-313 | ||||||||||||||||||
| 327 | return executed 47 times by 3 tests: QNetworkRequest::LocationHeader; return QNetworkRequest::LocationHeader;Executed by: 
 executed 47 times by 3 tests:  return QNetworkRequest::LocationHeader;Executed by: 
 | 47 | ||||||||||||||||||
| 328 | else if (qstricmp(headerName.constData(), "last-modified") == 0 
 | 0-313 | ||||||||||||||||||
| 329 | return executed 313 times by 5 tests: QNetworkRequest::LastModifiedHeader; return QNetworkRequest::LastModifiedHeader;Executed by: 
 executed 313 times by 5 tests:  return QNetworkRequest::LastModifiedHeader;Executed by: 
 | 313 | ||||||||||||||||||
| 330 | break; never executed:  break; | 0 | ||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | case executed 851 times by 7 tests: 's': case 's':Executed by: 
 executed 851 times by 7 tests:  case 's':Executed by: 
 | 851 | ||||||||||||||||||
| 333 | if (qstricmp(headerName.constData(), "set-cookie") == 0 
 | 19-832 | ||||||||||||||||||
| 334 | return executed 19 times by 3 tests: QNetworkRequest::SetCookieHeader; return QNetworkRequest::SetCookieHeader;Executed by: 
 executed 19 times by 3 tests:  return QNetworkRequest::SetCookieHeader;Executed by: 
 | 19 | ||||||||||||||||||
| 335 | else if (qstricmp(headerName.constData(), "server") == 0 
 | 1-831 | ||||||||||||||||||
| 336 | return executed 831 times by 5 tests: QNetworkRequest::ServerHeader; return QNetworkRequest::ServerHeader;Executed by: 
 executed 831 times by 5 tests:  return QNetworkRequest::ServerHeader;Executed by: 
 | 831 | ||||||||||||||||||
| 337 | break; executed 1 time by 1 test:  break;Executed by: 
 | 1 | ||||||||||||||||||
| 338 | - | |||||||||||||||||||
| 339 | case executed 9 times by 2 tests: 'u': case 'u':Executed by: 
 executed 9 times by 2 tests:  case 'u':Executed by: 
 | 9 | ||||||||||||||||||
| 340 | if (qstricmp(headerName.constData(), "user-agent") == 0 
 | 0-9 | ||||||||||||||||||
| 341 | return executed 9 times by 2 tests: QNetworkRequest::UserAgentHeader; return QNetworkRequest::UserAgentHeader;Executed by: 
 executed 9 times by 2 tests:  return QNetworkRequest::UserAgentHeader;Executed by: 
 | 9 | ||||||||||||||||||
| 342 | break; never executed:  break; | 0 | ||||||||||||||||||
| 343 | } | - | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | return executed 3128 times by 8 tests: -1; return -1;Executed by: 
 executed 3128 times by 8 tests:  return -1;Executed by: 
 | 3128 | ||||||||||||||||||
| 346 | } | - | ||||||||||||||||||
| 347 | - | |||||||||||||||||||
| 348 | static QVariant parseHttpDate(const QByteArray &raw) | - | ||||||||||||||||||
| 349 | { | - | ||||||||||||||||||
| 350 | QDateTime dt = QNetworkHeadersPrivate::fromHttpDate(raw); | - | ||||||||||||||||||
| 351 | if (dt.isValid() 
 | 0-313 | ||||||||||||||||||
| 352 | return executed 313 times by 5 tests: dt; return dt;Executed by: 
 executed 313 times by 5 tests:  return dt;Executed by: 
 | 313 | ||||||||||||||||||
| 353 | return never executed: QVariant(); return QVariant();never executed:  return QVariant(); | 0 | ||||||||||||||||||
| 354 | } | - | ||||||||||||||||||
| 355 | - | |||||||||||||||||||
| 356 | static QVariant parseCookieHeader(const QByteArray &raw) | - | ||||||||||||||||||
| 357 | { | - | ||||||||||||||||||
| 358 | QList<QNetworkCookie> result; | - | ||||||||||||||||||
| 359 | QList<QByteArray> cookieList = raw.split(';'); | - | ||||||||||||||||||
| 360 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cookieList)>::type> _container_((cookieList)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QByteArray &cookie = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
| 361 | QList<QNetworkCookie> parsed = QNetworkCookie::parseCookies(cookie.trimmed()); | - | ||||||||||||||||||
| 362 | if (parsed.count() != 1 
 | 0-3 | ||||||||||||||||||
| 363 | return never executed: QVariant(); return QVariant();never executed:  return QVariant(); | 0 | ||||||||||||||||||
| 364 | - | |||||||||||||||||||
| 365 | result += parsed; | - | ||||||||||||||||||
| 366 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 367 | - | |||||||||||||||||||
| 368 | return executed 2 times by 1 test: QVariant::fromValue(result); return QVariant::fromValue(result);Executed by: 
 executed 2 times by 1 test:  return QVariant::fromValue(result);Executed by: 
 | 2 | ||||||||||||||||||
| 369 | } | - | ||||||||||||||||||
| 370 | - | |||||||||||||||||||
| 371 | static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QByteArray &value) | - | ||||||||||||||||||
| 372 | { | - | ||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | switch (header) { | - | ||||||||||||||||||
| 375 | case executed 9 times by 2 tests: QNetworkRequest::UserAgentHeader: case QNetworkRequest::UserAgentHeader:Executed by: 
 executed 9 times by 2 tests:  case QNetworkRequest::UserAgentHeader:Executed by: 
 | 9 | ||||||||||||||||||
| 376 | case executed 831 times by 5 tests: QNetworkRequest::ServerHeader: case QNetworkRequest::ServerHeader:Executed by: 
 executed 831 times by 5 tests:  case QNetworkRequest::ServerHeader:Executed by: 
 | 831 | ||||||||||||||||||
| 377 | case executed 917 times by 6 tests: QNetworkRequest::ContentTypeHeader: case QNetworkRequest::ContentTypeHeader:Executed by: 
 executed 917 times by 6 tests:  case QNetworkRequest::ContentTypeHeader:Executed by: 
 | 917 | ||||||||||||||||||
| 378 | - | |||||||||||||||||||
| 379 | return executed 1757 times by 7 tests: QString::fromLatin1(value); return QString::fromLatin1(value);Executed by: 
 executed 1757 times by 7 tests:  return QString::fromLatin1(value);Executed by: 
 | 1757 | ||||||||||||||||||
| 380 | - | |||||||||||||||||||
| 381 | case executed 589 times by 7 tests: QNetworkRequest::ContentLengthHeader: case QNetworkRequest::ContentLengthHeader:Executed by: 
 executed 589 times by 7 tests: { case QNetworkRequest::ContentLengthHeader:Executed by: 
 | 589 | ||||||||||||||||||
| 382 | bool ok; | - | ||||||||||||||||||
| 383 | qint64 result = value.trimmed().toLongLong(&ok); | - | ||||||||||||||||||
| 384 | if (ok 
 | 2-587 | ||||||||||||||||||
| 385 | return executed 587 times by 7 tests: result; return result;Executed by: 
 executed 587 times by 7 tests:  return result;Executed by: 
 | 587 | ||||||||||||||||||
| 386 | return executed 2 times by 1 test: QVariant(); return QVariant();Executed by: 
 executed 2 times by 1 test:  return QVariant();Executed by: 
 | 2 | ||||||||||||||||||
| 387 | } | - | ||||||||||||||||||
| 388 | - | |||||||||||||||||||
| 389 | case executed 47 times by 3 tests: QNetworkRequest::LocationHeader: case QNetworkRequest::LocationHeader:Executed by: 
 executed 47 times by 3 tests: { case QNetworkRequest::LocationHeader:Executed by: 
 | 47 | ||||||||||||||||||
| 390 | QUrl result = QUrl::fromEncoded(value, QUrl::StrictMode); | - | ||||||||||||||||||
| 391 | if (result.isValid() 
 
 | 1-45 | ||||||||||||||||||
| 392 | return executed 44 times by 3 tests: result; return result;Executed by: 
 executed 44 times by 3 tests:  return result;Executed by: 
 | 44 | ||||||||||||||||||
| 393 | return executed 3 times by 1 test: QVariant(); return QVariant();Executed by: 
 executed 3 times by 1 test:  return QVariant();Executed by: 
 | 3 | ||||||||||||||||||
| 394 | } | - | ||||||||||||||||||
| 395 | - | |||||||||||||||||||
| 396 | case executed 313 times by 5 tests: QNetworkRequest::LastModifiedHeader: case QNetworkRequest::LastModifiedHeader:Executed by: 
 executed 313 times by 5 tests:  case QNetworkRequest::LastModifiedHeader:Executed by: 
 | 313 | ||||||||||||||||||
| 397 | return executed 313 times by 5 tests: parseHttpDate(value); return parseHttpDate(value);Executed by: 
 executed 313 times by 5 tests:  return parseHttpDate(value);Executed by: 
 | 313 | ||||||||||||||||||
| 398 | - | |||||||||||||||||||
| 399 | case executed 2 times by 1 test: QNetworkRequest::CookieHeader: case QNetworkRequest::CookieHeader:Executed by: 
 executed 2 times by 1 test:  case QNetworkRequest::CookieHeader:Executed by: 
 | 2 | ||||||||||||||||||
| 400 | return executed 2 times by 1 test: parseCookieHeader(value); return parseCookieHeader(value);Executed by: 
 executed 2 times by 1 test:  return parseCookieHeader(value);Executed by: 
 | 2 | ||||||||||||||||||
| 401 | - | |||||||||||||||||||
| 402 | case executed 19 times by 3 tests: QNetworkRequest::SetCookieHeader: case QNetworkRequest::SetCookieHeader:Executed by: 
 executed 19 times by 3 tests:  case QNetworkRequest::SetCookieHeader:Executed by: 
 | 19 | ||||||||||||||||||
| 403 | return executed 19 times by 3 tests: QVariant::fromValue(QNetworkCookie::parseCookies(value)); return QVariant::fromValue(QNetworkCookie::parseCookies(value));Executed by: 
 executed 19 times by 3 tests:  return QVariant::fromValue(QNetworkCookie::parseCookies(value));Executed by: 
 | 19 | ||||||||||||||||||
| 404 | - | |||||||||||||||||||
| 405 | default never executed: : default:never executed:  default: | 0 | ||||||||||||||||||
| 406 | ((!(0)) ? qt_assert("0",__FILE__,899) : qt_noop()); | - | ||||||||||||||||||
| 407 | } never executed:  end of block | 0 | ||||||||||||||||||
| 408 | return never executed: QVariant(); return QVariant();never executed:  return QVariant(); | 0 | ||||||||||||||||||
| 409 | } | - | ||||||||||||||||||
| 410 | - | |||||||||||||||||||
| 411 | QNetworkHeadersPrivate::RawHeadersList::ConstIterator | - | ||||||||||||||||||
| 412 | QNetworkHeadersPrivate::findRawHeader(const QByteArray &key) const | - | ||||||||||||||||||
| 413 | { | - | ||||||||||||||||||
| 414 | RawHeadersList::ConstIterator it = rawHeaders.constBegin(); | - | ||||||||||||||||||
| 415 | RawHeadersList::ConstIterator end = rawHeaders.constEnd(); | - | ||||||||||||||||||
| 416 | for ( ; it != end 
 | 6777-20002 | ||||||||||||||||||
| 417 | if (qstricmp(it->first.constData(), key.constData()) == 0 
 | 1002-19000 | ||||||||||||||||||
| 418 | return executed 1002 times by 7 tests: it; return it;Executed by: 
 executed 1002 times by 7 tests:  return it;Executed by: 
 | 1002 | ||||||||||||||||||
| 419 | - | |||||||||||||||||||
| 420 | return executed 6777 times by 13 tests: end; return end;Executed by: 
 executed 6777 times by 13 tests:  return end;Executed by: 
 | 6777 | ||||||||||||||||||
| 421 | } | - | ||||||||||||||||||
| 422 | - | |||||||||||||||||||
| 423 | QNetworkHeadersPrivate::RawHeadersList QNetworkHeadersPrivate::allRawHeaders() const | - | ||||||||||||||||||
| 424 | { | - | ||||||||||||||||||
| 425 | return executed 26 times by 2 tests: rawHeaders; return rawHeaders;Executed by: 
 executed 26 times by 2 tests:  return rawHeaders;Executed by: 
 | 26 | ||||||||||||||||||
| 426 | } | - | ||||||||||||||||||
| 427 | - | |||||||||||||||||||
| 428 | QList<QByteArray> QNetworkHeadersPrivate::rawHeadersKeys() const | - | ||||||||||||||||||
| 429 | { | - | ||||||||||||||||||
| 430 | QList<QByteArray> result; | - | ||||||||||||||||||
| 431 | result.reserve(rawHeaders.size()); | - | ||||||||||||||||||
| 432 | RawHeadersList::ConstIterator it = rawHeaders.constBegin(), | - | ||||||||||||||||||
| 433 | end = rawHeaders.constEnd(); | - | ||||||||||||||||||
| 434 | for ( ; it != end 
 | 1079-1532 | ||||||||||||||||||
| 435 | result << it->first; executed 1079 times by 6 tests:  result << it->first;Executed by: 
 | 1079 | ||||||||||||||||||
| 436 | - | |||||||||||||||||||
| 437 | return executed 1532 times by 14 tests: result; return result;Executed by: 
 executed 1532 times by 14 tests:  return result;Executed by: 
 | 1532 | ||||||||||||||||||
| 438 | } | - | ||||||||||||||||||
| 439 | - | |||||||||||||||||||
| 440 | void QNetworkHeadersPrivate::setRawHeader(const QByteArray &key, const QByteArray &value) | - | ||||||||||||||||||
| 441 | { | - | ||||||||||||||||||
| 442 | if (key.isEmpty() 
 | 2-5692 | ||||||||||||||||||
| 443 | - | |||||||||||||||||||
| 444 | return; executed 2 times by 1 test:  return;Executed by: 
 | 2 | ||||||||||||||||||
| 445 | - | |||||||||||||||||||
| 446 | setRawHeaderInternal(key, value); | - | ||||||||||||||||||
| 447 | parseAndSetHeader(key, value); | - | ||||||||||||||||||
| 448 | } executed 5692 times by 8 tests:  end of blockExecuted by: 
 | 5692 | ||||||||||||||||||
| 449 | void QNetworkHeadersPrivate::setAllRawHeaders(const RawHeadersList &list) | - | ||||||||||||||||||
| 450 | { | - | ||||||||||||||||||
| 451 | cookedHeaders.clear(); | - | ||||||||||||||||||
| 452 | rawHeaders = list; | - | ||||||||||||||||||
| 453 | - | |||||||||||||||||||
| 454 | RawHeadersList::ConstIterator it = rawHeaders.constBegin(); | - | ||||||||||||||||||
| 455 | RawHeadersList::ConstIterator end = rawHeaders.constEnd(); | - | ||||||||||||||||||
| 456 | for ( ; it != end 
 | 107-164 | ||||||||||||||||||
| 457 | parseAndSetHeader(it->first, it->second); executed 164 times by 3 tests:  parseAndSetHeader(it->first, it->second);Executed by: 
 | 164 | ||||||||||||||||||
| 458 | } executed 107 times by 3 tests:  end of blockExecuted by: 
 | 107 | ||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | void QNetworkHeadersPrivate::setCookedHeader(QNetworkRequest::KnownHeaders header, | - | ||||||||||||||||||
| 461 | const QVariant &value) | - | ||||||||||||||||||
| 462 | { | - | ||||||||||||||||||
| 463 | QByteArray name = headerName(header); | - | ||||||||||||||||||
| 464 | if (name.isEmpty() 
 | 0-459 | ||||||||||||||||||
| 465 | - | |||||||||||||||||||
| 466 | QMessageLogger(__FILE__, 968, __PRETTY_FUNCTION__).warning("QNetworkRequest::setHeader: invalid header value KnownHeader(%d) received", header); | - | ||||||||||||||||||
| 467 | return; never executed:  return; | 0 | ||||||||||||||||||
| 468 | } | - | ||||||||||||||||||
| 469 | - | |||||||||||||||||||
| 470 | if (value.isNull() 
 | 4-455 | ||||||||||||||||||
| 471 | setRawHeaderInternal(name, QByteArray()); | - | ||||||||||||||||||
| 472 | cookedHeaders.remove(header); | - | ||||||||||||||||||
| 473 | } executed 4 times by 2 tests: else { end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 474 | QByteArray rawValue = headerValue(header, value); | - | ||||||||||||||||||
| 475 | if (rawValue.isEmpty() 
 | 0-455 | ||||||||||||||||||
| 476 | QMessageLogger(__FILE__, 978, __PRETTY_FUNCTION__).warning("QNetworkRequest::setHeader: QVariant of type %s cannot be used with header %s", | - | ||||||||||||||||||
| 477 | value.typeName(), name.constData()); | - | ||||||||||||||||||
| 478 | return; never executed:  return; | 0 | ||||||||||||||||||
| 479 | } | - | ||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | setRawHeaderInternal(name, rawValue); | - | ||||||||||||||||||
| 482 | cookedHeaders.insert(header, value); | - | ||||||||||||||||||
| 483 | } executed 455 times by 5 tests:  end of blockExecuted by: 
 | 455 | ||||||||||||||||||
| 484 | } | - | ||||||||||||||||||
| 485 | - | |||||||||||||||||||
| 486 | void QNetworkHeadersPrivate::setRawHeaderInternal(const QByteArray &key, const QByteArray &value) | - | ||||||||||||||||||
| 487 | { | - | ||||||||||||||||||
| 488 | RawHeadersList::Iterator it = rawHeaders.begin(); | - | ||||||||||||||||||
| 489 | while (it != rawHeaders.end() 
 | 6151-17664 | ||||||||||||||||||
| 490 | if (qstricmp(it->first.constData(), key.constData()) == 0 
 | 44-17620 | ||||||||||||||||||
| 491 | it = rawHeaders.erase(it); executed 44 times by 3 tests:  it = rawHeaders.erase(it);Executed by: 
 | 44 | ||||||||||||||||||
| 492 | else | - | ||||||||||||||||||
| 493 | ++ executed 17620 times by 9 tests: it; ++it;Executed by: 
 executed 17620 times by 9 tests:  ++it;Executed by: 
 | 17620 | ||||||||||||||||||
| 494 | } | - | ||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | if (value.isNull() 
 | 9-6142 | ||||||||||||||||||
| 497 | return; executed 9 times by 2 tests:  return;Executed by: 
 | 9 | ||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | RawHeaderPair pair; | - | ||||||||||||||||||
| 500 | pair.first = key; | - | ||||||||||||||||||
| 501 | pair.second = value; | - | ||||||||||||||||||
| 502 | rawHeaders.append(pair); | - | ||||||||||||||||||
| 503 | } executed 6142 times by 9 tests:  end of blockExecuted by: 
 | 6142 | ||||||||||||||||||
| 504 | - | |||||||||||||||||||
| 505 | void QNetworkHeadersPrivate::parseAndSetHeader(const QByteArray &key, const QByteArray &value) | - | ||||||||||||||||||
| 506 | { | - | ||||||||||||||||||
| 507 | - | |||||||||||||||||||
| 508 | const int parsedKeyAsInt = parseHeaderName(key); | - | ||||||||||||||||||
| 509 | if (parsedKeyAsInt != -1 
 | 2728-3128 | ||||||||||||||||||
| 510 | const QNetworkRequest::KnownHeaders parsedKey | - | ||||||||||||||||||
| 511 | = static_cast<QNetworkRequest::KnownHeaders>(parsedKeyAsInt); | - | ||||||||||||||||||
| 512 | if (value.isNull() 
 | 0-2728 | ||||||||||||||||||
| 513 | cookedHeaders.remove(parsedKey); | - | ||||||||||||||||||
| 514 | } never executed: else if (parsedKey == QNetworkRequest::ContentLengthHeader end of block
 | 0-2138 | ||||||||||||||||||
| 515 | && cookedHeaders.contains(QNetworkRequest::ContentLengthHeader) 
 | 1-589 | ||||||||||||||||||
| 516 | - | |||||||||||||||||||
| 517 | - | |||||||||||||||||||
| 518 | } executed 1 time by 1 test: else { end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 519 | cookedHeaders.insert(parsedKey, parseHeaderValue(parsedKey, value)); | - | ||||||||||||||||||
| 520 | } executed 2727 times by 8 tests:  end of blockExecuted by: 
 | 2727 | ||||||||||||||||||
| 521 | - | |||||||||||||||||||
| 522 | } | - | ||||||||||||||||||
| 523 | } executed 5856 times by 8 tests:  end of blockExecuted by: 
 | 5856 | ||||||||||||||||||
| 524 | - | |||||||||||||||||||
| 525 | - | |||||||||||||||||||
| 526 | - | |||||||||||||||||||
| 527 | - | |||||||||||||||||||
| 528 | static int name_to_month(const char* month_str) | - | ||||||||||||||||||
| 529 | { | - | ||||||||||||||||||
| 530 | switch (month_str[0]) { | - | ||||||||||||||||||
| 531 | case executed 20 times by 1 test: 'J': case 'J':Executed by: 
 executed 20 times by 1 test:  case 'J':Executed by: 
 | 20 | ||||||||||||||||||
| 532 | switch (month_str[1]) { | - | ||||||||||||||||||
| 533 | case executed 20 times by 1 test: 'a': case 'a':Executed by: 
 executed 20 times by 1 test:  case 'a':Executed by: 
 | 20 | ||||||||||||||||||
| 534 | return executed 20 times by 1 test: 1; return 1;Executed by: 
 executed 20 times by 1 test:  return 1;Executed by: 
 | 20 | ||||||||||||||||||
| 535 | case never executed: 'u': case 'u':never executed:  case 'u': | 0 | ||||||||||||||||||
| 536 | switch (month_str[2] ) { | - | ||||||||||||||||||
| 537 | case never executed: 'n': case 'n':never executed:  case 'n': | 0 | ||||||||||||||||||
| 538 | return never executed: 6; return 6;never executed:  return 6; | 0 | ||||||||||||||||||
| 539 | case never executed: 'l': case 'l':never executed:  case 'l': | 0 | ||||||||||||||||||
| 540 | return never executed: 7; return 7;never executed:  return 7; | 0 | ||||||||||||||||||
| 541 | } | - | ||||||||||||||||||
| 542 | } never executed:  end of block | 0 | ||||||||||||||||||
| 543 | break; never executed:  break; | 0 | ||||||||||||||||||
| 544 | case never executed: 'F': case 'F':never executed:  case 'F': | 0 | ||||||||||||||||||
| 545 | return never executed: 2; return 2;never executed:  return 2; | 0 | ||||||||||||||||||
| 546 | case executed 63 times by 1 test: 'M': case 'M':Executed by: 
 executed 63 times by 1 test:  case 'M':Executed by: 
 | 63 | ||||||||||||||||||
| 547 | switch (month_str[2] ) { | - | ||||||||||||||||||
| 548 | case executed 1 time by 1 test: 'r': case 'r':Executed by: 
 executed 1 time by 1 test:  case 'r':Executed by: 
 | 1 | ||||||||||||||||||
| 549 | return executed 1 time by 1 test: 3; return 3;Executed by: 
 executed 1 time by 1 test:  return 3;Executed by: 
 | 1 | ||||||||||||||||||
| 550 | case executed 62 times by 1 test: 'y': case 'y':Executed by: 
 executed 62 times by 1 test:  case 'y':Executed by: 
 | 62 | ||||||||||||||||||
| 551 | return executed 62 times by 1 test: 5; return 5;Executed by: 
 executed 62 times by 1 test:  return 5;Executed by: 
 | 62 | ||||||||||||||||||
| 552 | } | - | ||||||||||||||||||
| 553 | break; never executed:  break; | 0 | ||||||||||||||||||
| 554 | case executed 15 times by 2 tests: 'A': case 'A':Executed by: 
 executed 15 times by 2 tests:  case 'A':Executed by: 
 | 15 | ||||||||||||||||||
| 555 | switch (month_str[1]) { | - | ||||||||||||||||||
| 556 | case never executed: 'p': case 'p':never executed:  case 'p': | 0 | ||||||||||||||||||
| 557 | return never executed: 4; return 4;never executed:  return 4; | 0 | ||||||||||||||||||
| 558 | case executed 15 times by 2 tests: 'u': case 'u':Executed by: 
 executed 15 times by 2 tests:  case 'u':Executed by: 
 | 15 | ||||||||||||||||||
| 559 | return executed 15 times by 2 tests: 8; return 8;Executed by: 
 executed 15 times by 2 tests:  return 8;Executed by: 
 | 15 | ||||||||||||||||||
| 560 | } | - | ||||||||||||||||||
| 561 | break; never executed:  break; | 0 | ||||||||||||||||||
| 562 | case executed 225 times by 4 tests: 'O': case 'O':Executed by: 
 executed 225 times by 4 tests:  case 'O':Executed by: 
 | 225 | ||||||||||||||||||
| 563 | return executed 225 times by 4 tests: 10; return 10;Executed by: 
 executed 225 times by 4 tests:  return 10;Executed by: 
 | 225 | ||||||||||||||||||
| 564 | case never executed: 'S': case 'S':never executed:  case 'S': | 0 | ||||||||||||||||||
| 565 | return never executed: 9; return 9;never executed:  return 9; | 0 | ||||||||||||||||||
| 566 | case executed 42 times by 3 tests: 'N': case 'N':Executed by: 
 executed 42 times by 3 tests:  case 'N':Executed by: 
 | 42 | ||||||||||||||||||
| 567 | return executed 42 times by 3 tests: 11; return 11;Executed by: 
 executed 42 times by 3 tests:  return 11;Executed by: 
 | 42 | ||||||||||||||||||
| 568 | case never executed: 'D': case 'D':never executed:  case 'D': | 0 | ||||||||||||||||||
| 569 | return never executed: 12; return 12;never executed:  return 12; | 0 | ||||||||||||||||||
| 570 | } | - | ||||||||||||||||||
| 571 | - | |||||||||||||||||||
| 572 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||||||||
| 573 | } | - | ||||||||||||||||||
| 574 | - | |||||||||||||||||||
| 575 | QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value) | - | ||||||||||||||||||
| 576 | { | - | ||||||||||||||||||
| 577 | - | |||||||||||||||||||
| 578 | - | |||||||||||||||||||
| 579 | - | |||||||||||||||||||
| 580 | - | |||||||||||||||||||
| 581 | - | |||||||||||||||||||
| 582 | - | |||||||||||||||||||
| 583 | int pos = value.indexOf(','); | - | ||||||||||||||||||
| 584 | QDateTime dt; | - | ||||||||||||||||||
| 585 | - | |||||||||||||||||||
| 586 | if (pos == -1 
 | 1-366 | ||||||||||||||||||
| 587 | - | |||||||||||||||||||
| 588 | dt = QDateTime::fromString(QString::fromLatin1(value), Qt::TextDate); | - | ||||||||||||||||||
| 589 | } executed 1 time by 1 test: else { end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 590 | - | |||||||||||||||||||
| 591 | - | |||||||||||||||||||
| 592 | if (pos == 3 
 | 1-365 | ||||||||||||||||||
| 593 | char month_name[4]; | - | ||||||||||||||||||
| 594 | int day, year, hour, minute, second; | - | ||||||||||||||||||
| 595 | - | |||||||||||||||||||
| 596 | - | |||||||||||||||||||
| 597 | - | |||||||||||||||||||
| 598 | - | |||||||||||||||||||
| 599 | - | |||||||||||||||||||
| 600 | - | |||||||||||||||||||
| 601 | if (sscanf(value.constData(), "%*3s, %d %3s %d %d:%d:%d 'GMT'", &day, month_name, &year, &hour, &minute, &second) == 6 
 | 0-365 | ||||||||||||||||||
| 602 | - | |||||||||||||||||||
| 603 | dt = QDateTime(QDate(year, name_to_month(month_name), day), QTime(hour, minute, second)); executed 365 times by 5 tests:  dt = QDateTime(QDate(year, name_to_month(month_name), day), QTime(hour, minute, second));Executed by: 
 | 365 | ||||||||||||||||||
| 604 | } executed 365 times by 5 tests: else { end of blockExecuted by: 
 | 365 | ||||||||||||||||||
| 605 | QLocale c = QLocale::c(); | - | ||||||||||||||||||
| 606 | - | |||||||||||||||||||
| 607 | QString sansWeekday = QString::fromLatin1(value.constData() + pos + 2); | - | ||||||||||||||||||
| 608 | - | |||||||||||||||||||
| 609 | dt = c.toDateTime(sansWeekday, QLatin1String("dd-MMM-yy hh:mm:ss 'GMT'")); | - | ||||||||||||||||||
| 610 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 611 | } | - | ||||||||||||||||||
| 612 | - | |||||||||||||||||||
| 613 | - | |||||||||||||||||||
| 614 | if (dt.isValid() 
 | 0-367 | ||||||||||||||||||
| 615 | dt.setTimeSpec(Qt::UTC); executed 367 times by 5 tests:  dt.setTimeSpec(Qt::UTC);Executed by: 
 | 367 | ||||||||||||||||||
| 616 | return executed 367 times by 5 tests: dt; return dt;Executed by: 
 executed 367 times by 5 tests:  return dt;Executed by: 
 | 367 | ||||||||||||||||||
| 617 | } | - | ||||||||||||||||||
| 618 | - | |||||||||||||||||||
| 619 | QByteArray QNetworkHeadersPrivate::toHttpDate(const QDateTime &dt) | - | ||||||||||||||||||
| 620 | { | - | ||||||||||||||||||
| 621 | return executed 79 times by 4 tests: QLocale::c().toString(dt, QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'")) return QLocale::c().toString(dt, QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'")) .toLatin1();Executed by: 
 executed 79 times by 4 tests:  return QLocale::c().toString(dt, QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'")) .toLatin1();Executed by: 
 | 79 | ||||||||||||||||||
| 622 | .toLatin1(); executed 79 times by 4 tests:  return QLocale::c().toString(dt, QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'")) .toLatin1();Executed by: 
 | 79 | ||||||||||||||||||
| 623 | } | - | ||||||||||||||||||
| 624 | - | |||||||||||||||||||
| 625 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |