static void basic(MprTestGroup *gp) { assert(simpleGet(gp, "/index.html", 0)); #if BLD_FEATURE_EGI && BLD_DEBUG assert(simpleGet(gp, "/egi/egiProgram", 0)); #endif #if BLD_FEATURE_EJS assert(simpleGet(gp, "/test.ejs", 0)); #endif }
static void encoding(MprTestGroup *gp) { assert(simpleGet(gp, "/egi/egi%20Program.egi?var%201=value%201", 0)); assert(match(gp, "QUERY_STRING", "var%201=value%201")); assert(matchAnyCase(gp, "SCRIPT_NAME", "/egi/egi Program.egi")); assert(match(gp, "QVAR var 1", "value 1")); }
static void setup(MprTestGroup *gp) { if (!simpleGet(gp, "/index.html", 0)) { mprError(gp, "Can't access web server at http://%s:%d/index.html", getDefaultHost(gp), getDefaultPort(gp)); exit(5); } }
static void alias(MprTestGroup *gp) { assert(simpleGet(gp, "/MyInProcScripts/egiProgram.egi", 0)); assert(match(gp, "QUERY_STRING", "")); assert(matchAnyCase(gp, "SCRIPT_NAME", "/MyInProcScripts/egiProgram.egi")); assert(match(gp, "PATH_INFO", "")); assert(match(gp, "PATH_TRANSLATED", NULL)); }
// virtual void LLHTTPNode::get(LLHTTPNode::ResponsePtr response, const LLSD& context) const { try { response->result(simpleGet()); } catch (NotImplemented) { response->methodNotAllowed(); } }
NetworkReply* NetworkAccess::get(const QUrl url) { QNetworkReply *networkReply = simpleGet(url); NetworkReply *reply = new NetworkReply(networkReply); // error signal connect(networkReply, SIGNAL(error(QNetworkReply::NetworkError)), reply, SLOT(requestError(QNetworkReply::NetworkError)), Qt::QueuedConnection); // when the request is finished we'll invoke the target method connect(networkReply, SIGNAL(finished()), reply, SLOT(finished()), Qt::QueuedConnection); return reply; }
NetworkReply* NetworkAccess::head(const QUrl url) { QNetworkReply *networkReply = simpleGet(url, QNetworkAccessManager::HeadOperation); NetworkReply *reply = new NetworkReply(networkReply); reply->followRedirects = false; // error signal connect(networkReply, SIGNAL(error(QNetworkReply::NetworkError)), reply, SLOT(requestError(QNetworkReply::NetworkError)), Qt::QueuedConnection); // when the request is finished we'll invoke the target method connect(networkReply, SIGNAL(finished()), reply, SLOT(finished()), Qt::QueuedConnection); return reply; }
QNetworkReply* NetworkAccess::syncGet(QUrl url) { working = true; networkReply = simpleGet(url); connect(networkReply, SIGNAL(metaDataChanged()), this, SLOT(syncMetaDataChanged()), Qt::QueuedConnection); connect(networkReply, SIGNAL(finished()), this, SLOT(syncFinished()), Qt::QueuedConnection); connect(networkReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError)), Qt::QueuedConnection); // A little trick to make this function blocking while (working) { // Do something else, maybe even network processing events qApp->processEvents(); } networkReply->deleteLater(); return networkReply; }
static void queryString(MprTestGroup *gp) { char *post; post = "name=Peter&address=777+Mulberry+Lane"; assert(simpleForm(gp, "/egi/egiProgram.egi?var1=a+a&var2=b%20b&var3=c", post, 0)); assert(match(gp, "QUERY_STRING", "var1=a+a&var2=b%20b&var3=c")); assert(match(gp, "QVAR var1", "a a")); assert(match(gp, "QVAR var2", "b b")); assert(match(gp, "QVAR var3", "c")); assert(match(gp, "PVAR name", "Peter")); assert(match(gp, "PVAR address", "777 Mulberry Lane")); assert(simpleGet(gp, "/egi/egiProgram.egi?var1=a+a&var2=b%20b&var3=c", 0)); /* * Query string vars should not be turned into variables for GETs */ assert(matchAnyCase(gp, "SCRIPT_NAME", "/egi/egiProgram.egi")); assert(match(gp, "QUERY_STRING", "var1=a+a&var2=b%20b&var3=c")); assert(match(gp, "QVAR var1", "a a")); assert(match(gp, "QVAR var2", "b b")); assert(match(gp, "QVAR var3", "c")); }
static void basic(MprTestGroup *gp) { assert(simpleGet(gp, "/egi/egiProgram", 0)); assert(simpleGet(gp, "/egiProgram.egi", 0)); }
static void mainServer(MprTestGroup *gp) { assert(simpleGet(gp, "/mainServer.html", 0)); }
static void script(MprTestGroup *gp) { assert(simpleGet(gp, "/cgi-bin/cgiProgram", 0)); }
static void simple(MprTestGroup *gp) { assert(simpleGet(gp, "/aliasDir/test.html", 0)); assert(simpleGet(gp, "/aliasFile/", 0)); }