diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-15 05:43:10 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-15 05:43:10 (GMT) |
commit | 96a3848f8f460a39d5bad1e5c78e61857645c28f (patch) | |
tree | 1938397954a921ba5733bb22d1b21afe4c9d342b /src/network/access | |
parent | cde72ad73cf2ee31e701e84763c152685493b7c7 (diff) | |
parent | 76055d4e4a3023ef6390d85a02688bb11df57284 (diff) | |
download | Qt-96a3848f8f460a39d5bad1e5c78e61857645c28f.zip Qt-96a3848f8f460a39d5bad1e5c78e61857645c28f.tar.gz Qt-96a3848f8f460a39d5bad1e5c78e61857645c28f.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
QNAM HTTP: Ignore double content-length headers
Don't pack Harfbuzz structs, this causes unaligned access crashes.
qmake vcxproj generator: fix description of custom build tools
Minor adjustments to merge-request 915
Implement brush transformations for directfb.
Add FreeBSD's certificate bundle to the certificates list.
SSL internals: upon error, read all errors from OpenSSL
Added an example for QTest::touchEvent to the documentation.
Push and pop the thread-default context for the current thread
Fix compilation by s/intptr_t/quintptr/
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qhttpnetworkheader.cpp | 12 | ||||
-rw-r--r-- | src/network/access/qnetworkrequest.cpp | 10 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp index 669f9cf..3eb2f3b 100644 --- a/src/network/access/qhttpnetworkheader.cpp +++ b/src/network/access/qhttpnetworkheader.cpp @@ -60,7 +60,17 @@ QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPri qint64 QHttpNetworkHeaderPrivate::contentLength() const { bool ok = false; - QByteArray value = headerField("content-length"); + // We are not using the headerField() method here because servers might send us multiple content-length + // headers which is crap (see QTBUG-15311). Therefore just take the first content-length header field. + QByteArray value; + QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(), + end = fields.constEnd(); + for ( ; it != end; ++it) + if (qstricmp("content-length", it->first) == 0) { + value = it->second; + break; + } + qint64 length = value.toULongLong(&ok); if (ok) return length; diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index b761af5..162392d 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -899,10 +899,16 @@ void QNetworkHeadersPrivate::parseAndSetHeader(const QByteArray &key, const QByt // is it a known header? QNetworkRequest::KnownHeaders parsedKey = parseHeaderName(key); if (parsedKey != QNetworkRequest::KnownHeaders(-1)) { - if (value.isNull()) + if (value.isNull()) { cookedHeaders.remove(parsedKey); - else + } else if (parsedKey == QNetworkRequest::ContentLengthHeader + && cookedHeaders.contains(QNetworkRequest::ContentLengthHeader)) { + // Only set the cooked header "Content-Length" once. + // See bug QTBUG-15311 + } else { cookedHeaders.insert(parsedKey, parseHeaderValue(parsedKey, value)); + } + } } |