Re: patch for wget

Hrvoje Niksic <[email protected]> Thu, 15 Sep 2005 17:18:36 +0200
Newsgroups gmane.comp.web.wget.patches
Message-ID <[email protected]>
Originally the code only checked for "text/html", with
"application/xhtml+xml" having been added as an afterthought.  A third
type is a clear sign that some refactoring is in order.  One obvious
choice is to remove those ugly defines and add a function like:

static bool
content_type_is_html (const char *ct)
{
  static char *html_types[] = {
    "text/html",
    "application/vnd.wap.xhtml+xml",
    "application/xhtml+xml",
  };
  int i;
  for (i = 0; i < countof (html_types); i++)
    if (0 == strcasecmp (ct, html_types[i]))
      return true;
  return false;
}