qhttpnetworkheader.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpnetworkheader.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QUrl &newUrl)-
9 :url(newUrl)-
10{-
11}-
12-
13QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPrivate &other)-
14 :QSharedData(other)-
15{-
16 url = other.url;-
17 fields = other.fields;-
18}-
19-
20qint64 QHttpNetworkHeaderPrivate::contentLength() const-
21{-
22 bool ok = false;-
23-
24-
25 QByteArray value;-
26 QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(),-
27 end = fields.constEnd();-
28 for ( ; it != end; ++it)-
29 if (qstricmp("content-length", it->first) == 0) {-
30 value = it->second;-
31 break;-
32 }-
33-
34 qint64 length = value.toULongLong(&ok);-
35 if (ok)-
36 return length;-
37 return -1;-
38}-
39-
40void QHttpNetworkHeaderPrivate::setContentLength(qint64 length)-
41{-
42 setHeaderField("Content-Length", QByteArray::number(length));-
43}-
44-
45QByteArray QHttpNetworkHeaderPrivate::headerField(const QByteArray &name, const QByteArray &defaultValue) const-
46{-
47 QList<QByteArray> allValues = headerFieldValues(name);-
48 if (allValues.isEmpty())-
49 return defaultValue;-
50 else-
51 return allValues.join(", ");-
52}-
53-
54QList<QByteArray> QHttpNetworkHeaderPrivate::headerFieldValues(const QByteArray &name) const-
55{-
56 QList<QByteArray> result;-
57 QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(),-
58 end = fields.constEnd();-
59 for ( ; it != end; ++it)-
60 if (qstricmp(name.constData(), it->first) == 0)-
61 result += it->second;-
62-
63 return result;-
64}-
65-
66void QHttpNetworkHeaderPrivate::setHeaderField(const QByteArray &name, const QByteArray &data)-
67{-
68 QList<auto firstEqualsName = [&name](const QPair<QByteArray, QByteArray> >::Iterator it = fields.begin();-
while (it != fields.end())&header) {
69 if (return
executed 20896 times by 8 tests: return qstricmp(name.constData(), header.first) == 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
executed 20896 times by 8 tests: return qstricmp(name.constData(), header.first) == 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
qstricmp(name.constData(), it->header.first) == 0)
executed 20896 times by 8 tests: return qstricmp(name.constData(), header.first) == 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
20896
it =
executed 20896 times by 8 tests: return qstricmp(name.constData(), header.first) == 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
executed 20896 times by 8 tests: return qstricmp(name.constData(), header.first) == 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
;
executed 20896 times by 8 tests: return qstricmp(name.constData(), header.first) == 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
70 };-
71 fields.erase(it);-
else
++it;
}std::remove_if(fields.begin(), fields.end(),
72 firstEqualsName),-
73 fields.end());-
74 fields.append(qMakePair(name, data));-
75}
executed 9410 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
9410
76-
77bool QHttpNetworkHeaderPrivate::operator==(const QHttpNetworkHeaderPrivate &other) const-
78{-
79 return (url == other.url);-
80}-
81-
82-
83-
Switch to Source codePreprocessed file

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