diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-09 12:40:22 +0200 |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-09 12:41:13 +0200 |
commit | 6574240d8ea657d02c3d5bf5567da7d28f42d69b (patch) | |
tree | 99a4d2715f1a0e82dae9833a28f3cb72a4f68a3d /src/network/access/qhttpnetworkreply.cpp | |
parent | 14ef40f9b96c5afea9d08701a2a1856388349f9e (diff) | |
download | qt4-tools-6574240d8ea657d02c3d5bf5567da7d28f42d69b.tar.gz |
QHttpNetworkReply: Cache isChunked
Cache return value of expensive function.
Reviewed-by: Peter Hartmann
Diffstat (limited to 'src/network/access/qhttpnetworkreply.cpp')
-rw-r--r-- | src/network/access/qhttpnetworkreply.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 483589b539..7a616aa7eb 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -201,6 +201,7 @@ bool QHttpNetworkReply::isFinished() const QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) : QHttpNetworkHeaderPrivate(newUrl), state(NothingDoneState), statusCode(100), majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0), + chunkedTransferEncoding(0), currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false), autoDecompress(false), responseData(0), requestIsPrepared(false) { @@ -506,6 +507,9 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) state = ReadingDataState; fragment.clear(); // next fragment bodyLength = contentLength(); // cache the length + + // cache isChunked() since it is called often + chunkedTransferEncoding = headerField("transfer-encoding").toLower().contains("chunked"); } return bytes; } @@ -546,7 +550,7 @@ void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header) bool QHttpNetworkReplyPrivate::isChunked() { - return headerField("transfer-encoding").toLower().contains("chunked"); + return chunkedTransferEncoding; } bool QHttpNetworkReplyPrivate::connectionCloseEnabled() |