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