mirror of
https://github.com/leahneukirchen/mblaze
synced 2024-11-03 15:40:32 +00:00
rfc2047: only decode _ as spaces when decoding headers
This commit is contained in:
parent
b336acc23c
commit
40b19264c5
@ -31,7 +31,7 @@ char *blaze822_orig_header(struct message *mesg);
|
||||
// rfc2047.c
|
||||
|
||||
int blaze822_decode_rfc2047(char *, char *, size_t, char *);
|
||||
int blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno);
|
||||
int blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno, int underscore);
|
||||
int blaze822_decode_b64(char *start, char *stop, char **deco, size_t *decleno);
|
||||
|
||||
// rfc2045.c
|
||||
|
@ -53,7 +53,7 @@ blaze822_mime_body(struct message *msg,
|
||||
|
||||
if (cte) {
|
||||
if (strncasecmp(cte, "quoted-printable", 16) == 0) {
|
||||
blaze822_decode_qp(msg->body, msg->bodyend, bodyo, bodyleno);
|
||||
blaze822_decode_qp(msg->body, msg->bodyend, bodyo, bodyleno, 0);
|
||||
*bodychunko = *bodyo;
|
||||
} else if (strncasecmp(cte, "base64", 6) == 0) {
|
||||
blaze822_decode_b64(msg->body, msg->bodyend, bodyo, bodyleno);
|
||||
|
@ -11,7 +11,7 @@
|
||||
// XXX keep trying bytewise on invalid iconv
|
||||
|
||||
int
|
||||
blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno)
|
||||
blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno, int underscore)
|
||||
{
|
||||
static signed char hex[] = {
|
||||
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
|
||||
@ -47,7 +47,7 @@ blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno)
|
||||
continue;
|
||||
}
|
||||
*buf++ = (hex[c1] << 4) | hex[c2];
|
||||
} else if (*s == '_') {
|
||||
} else if (underscore && *s == '_') {
|
||||
*buf++ = ' ';
|
||||
s++;
|
||||
} else {
|
||||
@ -191,7 +191,7 @@ blaze822_decode_rfc2047(char *dst, char *src, size_t dlen, char *tgtenc)
|
||||
char *dec = 0, *decchunk;
|
||||
size_t declen = 0;
|
||||
if (enc == 'q')
|
||||
blaze822_decode_qp(start, stop, &dec, &declen);
|
||||
blaze822_decode_qp(start, stop, &dec, &declen, 1);
|
||||
else if (enc == 'b')
|
||||
blaze822_decode_b64(start, stop, &dec, &declen);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user