9367c4abbf200b833b19c5fe77a198c41a48c809 galt Fri Feb 24 18:29:08 2017 -0800 Adding new function strictTagNestCheck to htmlCheck. CSP testing turned up CGI webpage output that was not even being parsed correctly or the same by various browsers because of reversed end-tags. htmlCheck should be able to find these problems too. Also added the pipe and comma chars to the chars allowed in urls by htmlPage.c diff --git src/utils/htmlCheck/htmlCheck.c src/utils/htmlCheck/htmlCheck.c index f098479..7c08e9d 100644 --- src/utils/htmlCheck/htmlCheck.c +++ src/utils/htmlCheck/htmlCheck.c @@ -29,30 +29,31 @@ " getHeader - read the header and print to stdout\n" " getCookies - print list of cookies\n" " getHtml - print the html, but not the header to stdout\n" " getForms - print the form structure to stdout\n" " getVars - print the form variables to stdout\n" " getLinks - print links\n" " getTags - print out just the tags\n" " checkLinks - check links in page\n" " checkLinks2 - check links in page and all subpages in same host\n" " (Just one level of recursion)\n" " checkLocalLinks - check local links in page\n" " checkLocalLinks2 - check local links in page and connected local pages\n" " (Just one level of recursion)\n" " submit - submit first form in page if any using 'GET' method\n" " validate - do some basic validations including TABLE/TR/TD nesting\n" + " strictTagNestCheck - check tags are correctly nested\n" "options:\n" " cookies=cookie.txt - Cookies is a two column file\n" " containing <cookieName><space><value><newLine>\n" "note: url will need to be in quotes if it contains an ampersand or question mark." ); } static struct optionSpec options[] = { {"cookies", OPTION_STRING}, {NULL, 0}, }; void checkOk(char *fullText) /* Parse out first line and check it's ok. */ { @@ -351,30 +352,35 @@ else if (sameString(command, "getForms")) htmlPrintForms(page, stdout); else if (sameString(command, "getVars")) getVars(page); else if (sameString(command, "getTags")) getTags(page); else if (sameString(command, "getCookies")) getCookies(page); else if (sameString(command, "submit")) quickSubmit(page); else if (sameString(command, "validate")) { htmlPageValidateOrAbort(page); verbose(1, "ok\n"); } + else if (sameString(command, "strictTagNestCheck")) + { + htmlPageStrictTagNestCheck(page); + verbose(1, "ok\n"); + } else if (sameString(command, "checkLinks")) checkLinks(page, 1, FALSE); else if (sameString(command, "checkLinks2")) checkLinks(page, 2, FALSE); else if (sameString(command, "checkLocalLinks")) checkLinks(page, 1, TRUE); else if (sameString(command, "checkLocalLinks2")) checkLinks(page, 2, TRUE); else errAbort("Unrecognized command %s", command); htmlPageFree(&page); } } int main(int argc, char *argv[])