void HTMLParser :: startParsing( TDocumentShared aDocument ) { mDocument = aDocument; bool insideDoc = true; try { if ( mContent.size() == 0 ) { throw ReadException(); } while ( insideDoc ) { getTag(); if ( isDocTypeTag() ) { doctypeTag(); continue; } if ( isHtmlTag() ) { htmlTag(); // Last tag, quit the loop insideDoc = false; continue; } cout << "startParsing: Unexpected tag found: " << mTag << ". Skipping...\n"; skipTag(); } } catch ( ReadException r ) { cout << "Unexpected end of file..\n"; cout << "Returning partial tree\n"; } }
void ACGI::cgiEnvironmentDump(int iFullDump) { htmlTag("br"); htmlTag("hr", "size=\"4\""); htmlTag("br"); htmlDoTag("h1", "Environment Dump"); htmlDoTag("h2", "HTTP Specific"); htmlStartTag("table", "width=\"100%\" border=\"2\""); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Accept"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPAccept()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Accept-Encoding"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPAcceptEncoding()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Accept-Language"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPAcceptLanguage()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Accept-Charset"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPAcceptCharset()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Authorization"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPAuthorization()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "ContentType"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetContentType()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "ContentLength"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetContentLength()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Cookie"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPCookie()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "From"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPFrom()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "If-Match"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPIfMatch()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "If-Modified-Since"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPIfModifiedSince()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "If-None-Match"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPIfNoneMatch()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "If-Range"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPIfRange()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "If-Unmodified-Since"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPIfUnmodifiedSince()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Max-Forwards"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPMaxForwards()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Proxy-Authorization"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPProxyAuthorization()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Pragma"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPPragma()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "QueryString"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetQueryString()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Range"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPRange()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Referer"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPReferer()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "RequestMethod"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetRequestMethod()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "TE"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPTE()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "User-Agent"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHTTPUserAgent()); htmlEndTag("tr"); htmlEndTag("table"); htmlDoTag("h2", "FORM data"); htmlStartTag("table", "width=\"100%\" border=\"2\""); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "FORM data (body of request)"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", getSafeFormData()); htmlEndTag("tr"); htmlEndTag("table"); htmlDoTag("h2", "Server Specific"); htmlStartTag("table", "width=\"100%\" border=\"2\""); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Annot. Server"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetAnnotationServer()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "ServerName"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetServerName()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "ServerSoftware"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetServerSoftware()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "ServerPort"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetServerPort()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "ServerProtocol"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetServerProtocol()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "GatewayInt"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetGatewayInterface()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "RemoteAddress"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetRemoteAddress()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "RemoteHost"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetRemoteHost()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "RemoteIdent"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetRemoteIdent()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Path"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetPath()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "PathInfo"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetPathInfo()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "PathTranslated= "); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetPathTranslated()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "ScriptName"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetScriptName()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "SHLVL"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetSHLVL()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "PWD"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetPWD()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "LogName"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetLogName()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "User"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetUser()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "Host"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHost()); htmlEndTag("tr"); htmlStartTag("tr"); htmlDoTagEx("th", "align=\"right\"", "HostType"); htmlDoTagEx("td", "bgcolor=\"#404040\" style=\"color: rgb(248,248,220)\"", cgiGetHostType()); htmlEndTag("tr"); htmlEndTag("table"); htmlTag("br"); htmlTag("hr", "size=\"4\""); htmlTag("br"); if (iFullDump) { htmlStartTag("pre"); #ifdef _DEBUG_DUMP_ outStringN("FORM and QueryString structure dump<br/>"); dump(); #else outStringCRN("<i>#define _DEBUG_DUMP_</i> and rebuild freeCGI for a full dump..."); #endif htmlEndTag("pre"); } }