Fixed a bug when there is a partly Content-Type header

This commit is contained in:
Michiel Broek 2005-08-15 18:40:47 +00:00
parent a78ed544a2
commit 33a7c3aebf

View File

@ -214,6 +214,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
if (q)
while (*q && isspace(*q))
q++;
if (!(q))
q = (char *)"8bit";
if ((p = hdr((char *)"Content-Type",msg))) {
@ -230,20 +231,22 @@ int rfc2ftn(FILE *fp, faddr *recipient)
q = strtok(p, " \n\0");
q = strtok(NULL, "; \n\0");
while (*q && isspace(*q))
q++;
Syslog('m', "charset part: %s", printable(q, 0));
if (q && (strncasecmp(q, "charset=", 8) == 0)) {
/*
* google.com quotes the charset name
*/
if (strchr(q, '"')) {
charset = xstrcpy(q + 9);
charset[strlen(charset)-1] = '\0';
} else {
charset = xstrcpy(q + 8);
if (q) {
while (*q && isspace(*q))
q++;
Syslog('m', "charset part: %s", printable(q, 0));
if (q && (strncasecmp(q, "charset=", 8) == 0)) {
/*
* google.com quotes the charset name
*/
if (strchr(q, '"')) {
charset = xstrcpy(q + 9);
charset[strlen(charset)-1] = '\0';
} else {
charset = xstrcpy(q + 8);
}
Syslog('m', "Charset \"%s\"", printable(charset, 0));
}
Syslog('m', "Charset \"%s\"", printable(charset, 0));
}
}