diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-01-14 10:01:21 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-01-14 10:05:54 (GMT) |
commit | 6ba1ce5f73f1f203e6d1c9eb4464edbd5ea3a82c (patch) | |
tree | 8b0573779895ebd416a142963056dde2506c0b9c /tests | |
parent | a998a8a1497c4c9176278bca9401f7954708eb9e (diff) | |
download | Qt-6ba1ce5f73f1f203e6d1c9eb4464edbd5ea3a82c.zip Qt-6ba1ce5f73f1f203e6d1c9eb4464edbd5ea3a82c.tar.gz Qt-6ba1ce5f73f1f203e6d1c9eb4464edbd5ea3a82c.tar.bz2 |
tst_qnetworkreply benchmark: Read HTTP headers when emulating HTTP
Reviewed-by: Peter Hartmann
Diffstat (limited to 'tests')
-rw-r--r-- | tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp index 6327123..a92359f 100644 --- a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp @@ -262,8 +262,22 @@ protected: port = server.serverPort(); ready.release(); - server.waitForNewConnection(-1); + QVERIFY(server.waitForNewConnection(10*1000)); client = server.nextPendingConnection(); + + // read lines until we read the empty line seperating HTTP request from HTTP request body + do { + if (client->canReadLine()) { + QString line = client->readLine(); + if (line == "\n" || line == "\r\n") + break; // empty line + } + if (!client->waitForReadyRead(10*1000)) { + client->close(); + return; + } + } while (client->state() == QAbstractSocket::ConnectedState); + client->write("HTTP/1.0 200 OK\r\n"); client->write("Content-length: 0\r\n"); client->write("\r\n"); |