For example if a mail had:
Name1: a
Name1: b
Name2: c
If the Name1: was initially added to cache and Name2: not, but later on both
were attempted to be added to cache, the Name2: lookup would have been added
with "b" instead of "c" value.
if (match_idx < match_count) {
/* save index to first header line */
+ i_assert(match_idx == lines[i].field_idx);
j = i + 1;
array_idx_set(&mail->header_match_lines, match_idx, &j);
match_idx++;
if (!mail_cache_field_can_add(_mail->transaction->cache_trans,
_mail->seq, lines[i].field_idx)) {
- /* header is already cached */
- j = i + 1;
+ /* header is already cached. skip over all the
+ header lines. */
+ for (j = i+1; j < count; j++) {
+ if (lines[j].field_idx != lines[i].field_idx)
+ break;
+ }
continue;
}