+ else if (strcasecmp(s->tag, "link") == EQ)
+ {
+ if (strcasecmp(s->attr, "href") == EQ)
+ {
+ link_href = p;
+ link_href_saved_size = *size; /* for restoration below */
+ }
+ else if (strcasecmp(s->attr, "rel") == EQ)
+ link_rel = p;
+
+ if (link_href != NULL && link_rel != NULL)
+ /* Okay, we've now seen this <LINK> tag's HREF and REL
+ attributes (they may be in either order), so it's now
+ possible to decide if we want to traverse it. */
+ if (!dash_p_leaf_HTML ||
+ strncasecmp(link_rel, "stylesheet",
+ sizeof("stylesheet") - 1) == EQ)
+ /* In the normal case, all <LINK> tags are fair game.
+
+ In the special case of when -p is active, however, and
+ we're at a leaf node (relative to the -l max. depth) in
+ the HTML document tree, the only <LINK> tag we'll
+ follow is a <LINK REL="stylesheet">, as it's necessary
+ for displaying this document properly. We won't follow
+ other <LINK> tags, like <LINK REL="home">, for
+ instance, as they refer to external documents.
+
+ Note that the above strncasecmp() will incorrectly
+ consider something like '<LINK REL="stylesheet.old"' as
+ equivalent to '<LINK REL="stylesheet"'. Not really
+ worth the trouble to explicitly check for such cases --
+ if time is spent, it should be spent ripping out wget's
+ somewhat kludgy HTML parser and hooking in a real,
+ componentized one. */
+ {
+ /* When we return, the 'size' IN/OUT parameter
+ determines where in the buffer the end of the current
+ attribute value is. If REL came after HREF in this
+ <LINK> tag, size is currently set to the size for
+ REL's value -- set it to what it was when we were
+ looking at HREF's value. */
+ *size = link_href_saved_size;
+
+ s->at_value = 1;
+ return link_href;
+ }
+ }
+ else if (!strcasecmp (s->tag, "meta") &&
+ !strcasecmp (s->attr, "content"))