diff --git a/src/http.c b/src/http.c
index 998cd10d..f5d9cafa 100644
--- a/src/http.c
+++ b/src/http.c
@@ -2552,14 +2552,14 @@ set_content_type (int *dt, const char *type)
      of the multitude of broken CGI's that "forget" to generate the
      content-type.  */
   if (!type ||
-      0 == strncasecmp (type, TEXTHTML_S, strlen (TEXTHTML_S)) ||
-      0 == strncasecmp (type, TEXTXHTML_S, strlen (TEXTXHTML_S)))
+      0 == c_strcasecmp (type, TEXTHTML_S) ||
+      0 == c_strcasecmp (type, TEXTXHTML_S))
     *dt |= TEXTHTML;
   else
     *dt &= ~TEXTHTML;
 
   if (type &&
-      0 == strncasecmp (type, TEXTCSS_S, strlen (TEXTCSS_S)))
+      0 == c_strcasecmp (type, TEXTCSS_S))
     *dt |= TEXTCSS;
   else
     *dt &= ~TEXTCSS;