diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-03 06:45:41 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-03 06:46:26 (GMT) |
commit | 142dc7e75faaf76894633851c25a907bd7e8b9b8 (patch) | |
tree | 3e4783e7576e47c16ba99a8a7d095058a29ab4ed /tests/auto/declarative/shared/testhttpserver.cpp | |
parent | 6abdaa41a3f40238e8a60b80b9ac55a694181e11 (diff) | |
download | Qt-142dc7e75faaf76894633851c25a907bd7e8b9b8.zip Qt-142dc7e75faaf76894633851c25a907bd7e8b9b8.tar.gz Qt-142dc7e75faaf76894633851c25a907bd7e8b9b8.tar.bz2 |
XMLHttpRequest redirection
Diffstat (limited to 'tests/auto/declarative/shared/testhttpserver.cpp')
-rw-r--r-- | tests/auto/declarative/shared/testhttpserver.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/declarative/shared/testhttpserver.cpp b/tests/auto/declarative/shared/testhttpserver.cpp index 6c9d849..490fc95 100644 --- a/tests/auto/declarative/shared/testhttpserver.cpp +++ b/tests/auto/declarative/shared/testhttpserver.cpp @@ -115,6 +115,11 @@ void TestHTTPServer::addAlias(const QString &filename, const QString &alias) aliases.insert(filename, alias); } +void TestHTTPServer::addRedirect(const QString &filename, const QString &redirectName) +{ + redirects.insert(filename, redirectName); +} + bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &body) { m_hasFailed = false; @@ -230,6 +235,12 @@ void TestHTTPServer::readyRead() bool TestHTTPServer::reply(QTcpSocket *socket, const QByteArray &fileName) { + if (redirects.contains(fileName)) { + QByteArray response = "HTTP/1.1 302 Found\r\nContent-length: 0\r\nContent-type: text/html; charset=UTF-8\r\nLocation: " + redirects[fileName].toUtf8() + "\r\n\r\n"; + socket->write(response); + return true; + } + for (int ii = 0; ii < dirs.count(); ++ii) { QString dir = dirs.at(ii).first; Mode mode = dirs.at(ii).second; |