/* ====================================================================== * The following code was written by Chad Phillips * It is based on code written by Theo Schlossnagle for use in the * Backhand project at The Center for Networking and Distributed Systems * at The Johns Hopkins University. * Please refer to the LICENSE file before using this software. * ====================================================================== */ #include "httpd.h" #include "http_log.h" #include "mod_backhand.h" int byTest(request_rec *r, ServerSlot *servers, int *n, char *arg) { int i, mycount; const char *session_id=NULL, *cookie, *identifier; identifier = "modbackhand_test"; /* Read in the users cookie file and look for the test cookie */ if(cookie = ap_table_get(r->headers_in, "Cookie")) { if(session_id = strstr(cookie, identifier)) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, "Found the test cookie, WEBTRENDS_ID "); /* if the test cookie is found, then we overwrite the current list of back hand servers with an array that only contains our one test server */ mycount=0; for(i=0;i<*n;i++) { if(session_id = strstr(arg, serverstats[servers[i].id].hostname)) { servers[mycount++] = servers[i]; } } *n=mycount; return mycount; } } else { } /* If we get this far, that means the user does not have the test cookie * overwrite the original list of back hand servers with an array that does NOT contain * our test server */ mycount=0; for(i=0;i<*n;i++) { if(session_id = strstr(arg, serverstats[servers[i].id].hostname)) { } else { servers[mycount++] = servers[i]; } } *n=mycount; return mycount; }