diff options
author | Tomasz Duda <tomaszduda23@gmail.com> | 2012-09-06 22:15:26 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-18 00:59:08 +0200 |
commit | 60f4fc8b706db9cbeacd5dc4886a7aa347daafc0 (patch) | |
tree | 6a6ed9f8a0e83c589fbb4ddf28bba3573fa70332 /src | |
parent | 58e2b9c01b31cef8a0fa263de3d984c22f1d7ca7 (diff) |
HTTP header may be damaged - fix, unit test
"HTTP/1.1 100 CONTINUE\r\n"
If the header from a server is splitted between two packets
the first packet contains "HTTP/1.1 100" and the second one
contains " CONTINUE\r\n", one space (0x20) is skipped. After
processing the line looks in this way "HTTP/1.1 100CONTINUE".
QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket)
is called twice, if a http header is splitted as above.
The function always removes whitespace from the beginning of a packet,
even if it is the second part of a http header.
QHttpNetworkReply returns QNetworkReply::RemoteHostClosedError
due to damaged http header during processing.
Improvement of unit test.
Task-number: QTBUG-27161
Change-Id: Ifc2949f62473209b4032185effbf5078b4130cda
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qhttpnetworkreply.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 14205112df..83838fb93a 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -411,7 +411,7 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) return -1; // unexpected EOF else if (haveRead == 0) break; // read more later - else if (haveRead == 1 && bytes == 0 && (c == 11 || c == '\n' || c == '\r' || c == ' ' || c == 31)) + else if (haveRead == 1 && fragment.size() == 0 && (c == 11 || c == '\n' || c == '\r' || c == ' ' || c == 31)) continue; // Ignore all whitespace that was trailing froma previous request on that socket bytes++; |