9562808bb257905689c06d196305e0b8234bf05b
kent
  Mon Oct 31 12:14:08 2016 -0700
Improving behavior when missing technically optional head section.

diff --git src/lib/htmlPage.c src/lib/htmlPage.c
index 69fc65f..c7bb61c 100644
--- src/lib/htmlPage.c
+++ src/lib/htmlPage.c
@@ -1822,34 +1822,36 @@
 if (page->header != NULL)
     contentType = hashFindVal(page->header, "Content-Type:");
 if (contentType == NULL || startsWith("text/html", contentType))
     {
     /* To simplify things upper case all tag names. */
     for (tag = page->tags; tag != NULL; tag = tag->next)
 	touppers(tag->name);
 
     checkExactlyOne(page->tags, "BODY");
 
     /* Validate header, and make a suggestion or two */
     if ((tag = page->tags) == NULL)
 	errAbort("No tags");
     if (!sameWord(tag->name, "HTML"))
 	errAbort("Doesn't start with <HTML> tag");
-    if ((tag = nextTagOfTypeInList(tag->next, "HEAD")) == NULL)
+    struct htmlTag *headTag = nextTagOfTypeInList(tag->next, "HEAD");
+    if (headTag == NULL)
         warn("No <HEAD> tag after <HTML> tag");
     else
 	{
+	tag = headTag;
 	for (;;)
 	    {
 	    tag = tag->next;
 	    if (tag == NULL)
 		errAbort("Missing </HEAD>");
 	    if (sameWord(tag->name, "TITLE"))
 		gotTitle = TRUE;
 	    if (sameWord(tag->name, "/HEAD"))
 		break;
 	    }
 	if (!gotTitle)
 	    warn("No title in <HEAD>");
 	validateNestingTags(page, page->tags, tag, headNesters, ArraySize(headNesters));
 	tag = tag->next;
 	}