842
return 1;
843
}
844
845
-static void handle_body(void)
845
+static void handle_body(struct strbuf *line)
846
{
847
struct strbuf prev = STRBUF_INIT;
848
int filter_stage = 0;
856
857
do {
858
/* process any boundary lines */
859
- if (*content_top && is_multipart_boundary(&line)) {
859
+ if (*content_top && is_multipart_boundary(line)) {
860
/* flush any leftover */
861
if (prev.len) {
862
handle_filter(&prev, &filter_stage, &header_stage);
867
}
868
869
/* Unwrap transfer encoding */
870
- decode_transfer_encoding(&line);
870
+ decode_transfer_encoding(line);
871
872
switch (transfer_encoding) {
873
case TE_BASE64:
876
struct strbuf **lines, **it, *sb;
877
878
/* Prepend any previous partial lines */
879
- strbuf_insert(&line, 0, prev.buf, prev.len);
879
+ strbuf_insert(line, 0, prev.buf, prev.len);
880
strbuf_reset(&prev);
881
882
/*
884
* multiple new lines. Pass only one chunk
885
* at a time to handle_filter()
886
*/
887
- lines = strbuf_split(&line, '\n');
887
+ lines = strbuf_split(line, '\n');
888
for (it = lines; (sb = *it); it++) {
889
if (*(it + 1) == NULL) /* The last line */
890
if (sb->buf[sb->len - 1] != '\n') {
902
break;
903
}
904
default:
905
- handle_filter(&line, &filter_stage, &header_stage);
905
+ handle_filter(line, &filter_stage, &header_stage);
906
}
907
908
- } while (!strbuf_getwholeline(&line, fin, '\n'));
908
+ } while (!strbuf_getwholeline(line, fin, '\n'));
909
910
handle_body_out:
911
strbuf_release(&prev);
991
while (read_one_header_line(&line, fin))
992
check_header(&line, p_hdr_data, 1);
993
994
- handle_body();
994
+ handle_body(&line);
995
fclose(patchfile);
996
997
handle_info();