summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2013-01-26 01:18:05 +0000
committerrandomdan <randomdan@localhost>2013-01-26 01:18:05 +0000
commit3966de8e718649870270d5cbdf671b395bfc0dcc (patch)
tree0f4c9f05a0b7f593b89efaae495c419f095d5bf8
parentDon't add null values to the XML output tree (diff)
downloadproject2-3966de8e718649870270d5cbdf671b395bfc0dcc.tar.bz2
project2-3966de8e718649870270d5cbdf671b395bfc0dcc.tar.xz
project2-3966de8e718649870270d5cbdf671b395bfc0dcc.zip
Allow reading URL list from a file for bulk testing
-rw-r--r--project2/cgi/testCgi.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/project2/cgi/testCgi.cpp b/project2/cgi/testCgi.cpp
index 8cf5606..6dc2193 100644
--- a/project2/cgi/testCgi.cpp
+++ b/project2/cgi/testCgi.cpp
@@ -58,6 +58,7 @@ class TestInput : public cgicc::CgiInput, public CgiEnvInput {
TESTOPT("HTTP_COOKIE", "", "Cookie")
TESTOPT("HTTPS", "No", "HTTPS?")
TESTOPT("HTTP_IF_MODIFIED_SINCE", "", "Client cached copy timestamp")
+ ("urlListFile", Options::value(&urlListFile, ""), "Load URL list from this file")
("runCount", Options::value(&runCount, 1), "Repeat run this many times")
;
FileOptions fo(".testCgi.settings");
@@ -81,8 +82,21 @@ class TestInput : public cgicc::CgiInput, public CgiEnvInput {
}
void run()
{
- for (int run = 0; run < runCount; run += 1) {
- cgiServe(this, &env, std::cout, this);
+ if (urlListFile.empty()) {
+ for (int run = 0; run < runCount; run += 1) {
+ cgiServe(this, &env, std::cout, this);
+ }
+ }
+ else {
+ for (int run = 0; run < runCount; run += 1) {
+ std::ifstream urls(urlListFile);
+ while (!urls.eof()) {
+ std::string url;
+ urls >> url;
+ optStore["REDIRECT_URL"] = StrPtr(new std::string(url));
+ cgiServe(this, &env, std::cout, this);
+ }
+ }
}
}
@@ -90,6 +104,7 @@ class TestInput : public cgicc::CgiInput, public CgiEnvInput {
CgiEnvironment env;
Options opts;
int runCount;
+ std::string urlListFile;
};
int