diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-05-13 11:27:01 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-05-13 11:55:58 (GMT) |
commit | a18ebd2a70e83863bc9a8cc64a65791a6d879f02 (patch) | |
tree | c7afcf827a8d297093eab50313124e3a0568c429 /tests | |
parent | 87022c9a4ab00a9faaf6bcdaa8d5884962ccf305 (diff) | |
download | Qt-a18ebd2a70e83863bc9a8cc64a65791a6d879f02.zip Qt-a18ebd2a70e83863bc9a8cc64a65791a6d879f02.tar.gz Qt-a18ebd2a70e83863bc9a8cc64a65791a6d879f02.tar.bz2 |
Improve the HTTP status line parsing and catch more errors.
There's no need for using QByteArrayMatcher for one single character,
so avoid the overhead.
Also validate the message header a bit more: we require the status
line to start with "HTTP/n.m " where n and m are positive integers
less than 10.
Task-number: 248838
Reviewed-by: Markus Goetz
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index c97fcf3..4be0863 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -1900,6 +1900,9 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer_data() QTest::newRow("with-newlines") << QByteArray("Long first line\r\nLong second line") << false; QTest::newRow("with-newlines2") << QByteArray("\r\nSecond line") << false; QTest::newRow("with-newlines3") << QByteArray("ICY\r\nSecond line") << false; + QTest::newRow("invalid-version") << QByteArray("HTTP/123 200 \r\n") << false; + QTest::newRow("invalid-version2") << QByteArray("HTTP/a.\033 200 \r\n") << false; + QTest::newRow("invalid-reply-code") << QByteArray("HTTP/1.0 fuu \r\n") << false; QTest::newRow("empty+disconnect") << QByteArray() << true; @@ -1909,6 +1912,10 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer_data() QTest::newRow("with-newlines+disconnect") << QByteArray("Long first line\r\nLong second line") << true; QTest::newRow("with-newlines2+disconnect") << QByteArray("\r\nSecond line") << true; QTest::newRow("with-newlines3+disconnect") << QByteArray("ICY\r\nSecond line") << true; + + QTest::newRow("invalid-version+disconnect") << QByteArray("HTTP/123 200 ") << true; + QTest::newRow("invalid-version2+disconnect") << QByteArray("HTTP/a.\033 200 ") << true; + QTest::newRow("invalid-reply-code+disconnect") << QByteArray("HTTP/1.0 fuu ") << true; } void tst_QNetworkReply::ioGetFromHttpBrokenServer() |