summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/misc.c b/src/misc.c
index 90d85983..9920fa0a 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -198,6 +198,7 @@ void a_Misc_parse_content_type(const char *str, char **major, char **minor,
char **charset)
{
const char *s;
+ bool_t is_text;
if (major)
*major = NULL;
@@ -211,6 +212,7 @@ void a_Misc_parse_content_type(const char *str, char **major, char **minor,
for (s = str; isalnum(*s) || (*s == '-'); s++);
if (major)
*major = dStrndup(str, s - str);
+ is_text = (s - str == 4) && !dStrncasecmp(str, "text", 4);
if (*s == '/') {
for (str = ++s; isalnum(*s) || (*s == '-'); s++);
@@ -218,7 +220,8 @@ void a_Misc_parse_content_type(const char *str, char **major, char **minor,
*minor = dStrndup(str, s - str);
}
- if (charset && *s) {
+ if (is_text && charset && *s) {
+ /* charset parameter is defined for text media type (RFC 2046) */
const char terminators[] = " ;\t";
const char key[] = "charset";