rspamd_mime_part_get_cte_heuristic (struct rspamd_task *task,
struct rspamd_mime_part *part)
{
- const guint check_len = 80;
- guint real_len, nspaces = 0, neqsign = 0, n8bit = 0;
+ const guint check_len = 128;
+ guint real_len, nspaces = 0, neqsign = 0, n8bit = 0, nqpencoded = 0;
gboolean b64_chars = TRUE;
const guchar *p, *end;
enum rspamd_cte ret = RSPAMD_CTE_UNKNOWN;
p ++;
}
+ if (end > p + 2) {
+ if (*(end - 1) == '=') {
+ neqsign ++;
+ end --;
+ }
+
+ if (*(end - 1) == '=') {
+ neqsign ++;
+ end --;
+ }
+ }
+
if (end - p > real_len) {
end = p + real_len;
}
}
else if (*p == '=') {
neqsign ++;
+ p ++;
+
+ if (p + 2 < end && g_ascii_isxdigit (*p) && g_ascii_isxdigit (*(p + 1))) {
+ p ++;
+ nqpencoded ++;
+ }
+
+ continue;
}
else if (*p >= 0x80) {
n8bit ++;
ret = RSPAMD_CTE_B64;
}
else if (n8bit == 0) {
- if (neqsign > 2 && nspaces > 2) {
+ if (neqsign > 2 && nqpencoded > 2) {
ret = RSPAMD_CTE_QP;
}
else {