| 581 | } |
| 582 | |
| 583 | static int check_header(struct mailinfo *mi, |
| 584 | const struct strbuf *line, |
| 585 | struct strbuf *hdr_data[], int overwrite) |
| 586 | { |
| 587 | int i, ret = 0; |
| 588 | struct strbuf sb = STRBUF_INIT; |
| 589 | |
| 590 | /* search for the interesting parts */ |
| 591 | for (i = 0; i < ARRAY_SIZE(header); i++) { |
| 592 | if ((!hdr_data[i] || overwrite) && |
| 593 | parse_header(line, header[i], mi, &sb)) { |
| 594 | handle_header(&hdr_data[i], &sb); |
| 595 | ret = 1; |
| 596 | goto check_header_out; |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | /* Content stuff */ |
| 601 | if (parse_header(line, "Content-Type", mi, &sb)) { |
| 602 | handle_content_type(mi, &sb); |
| 603 | ret = 1; |
| 604 | goto check_header_out; |
| 605 | } |
| 606 | if (parse_header(line, "Content-Transfer-Encoding", mi, &sb)) { |
| 607 | handle_content_transfer_encoding(mi, &sb); |
| 608 | ret = 1; |
| 609 | goto check_header_out; |
| 610 | } |
| 611 | if (parse_header(line, "Message-ID", mi, &sb)) { |
| 612 | if (mi->add_message_id) |
| 613 | mi->message_id = strbuf_detach(&sb, NULL); |
| 614 | ret = 1; |
| 615 | goto check_header_out; |
| 616 | } |
| 617 | |
| 618 | check_header_out: |
| 619 | strbuf_release(&sb); |
| 620 | return ret; |
| 621 | } |
| 622 | |
| 623 | /* |
| 624 | * Returns 1 if the given line or any line beginning with the given line is an |
no test coverage detected