anchor.diff:      try
           Boundary = get_multipart_boundary(Req),
           Length = get_content_length(Req),
  -        ok = crash_if_too_big(Length),
  +        ok = crash_if_too_big(Length, #state{parts = []}),
           Data = get_opening_body(Req), 
           State = init_state(Req, Boundary, Length, Data),
           State1 = read_boundary(Data, State),
           {Params, Files} = process_parts(State1#state.parts),
           {ok, Params, Files}
       catch
  -        throw : post_too_big -> {error, post_too_big};
  -        throw : {file_too_big, FileName} -> {error, {file_too_big, FileName}}
  +        throw : {Reason, ErrState} ->
  +            lists:foreach(fun(Part) ->
  +                file:delete(Part#sb_uploaded_file.temp_file)
  +            end, convert_parts_to_files(ErrState#state.parts)),
  +            {error, Reason}
       end.
   
   get_content_length(Req) ->
  
positive.code: get_next_line(<<?NEWLINE, Data/binary>>, Acc, Part, State) -> {<<Acc/binary>>, Data, Part, State};
  get_next_line(<<C, Data/binary>>, Acc, Part, State) -> get_next_line(Data, <<Acc/binary, C>>, Part, State);
  get_next_line(Data, Acc, Part, State) when Data == undefined orelse Data == <<>> ->
      {Data1, State1} = read_chunk(State),
  
      % We don't want Acc to grow too big, so if we have more than ?CHUNKSIZE 
      % data already read, then flush it to the current part.
      {Acc1, Part1} = case Part /= undefined andalso size(Acc) > ?CHUNKSIZE of
                          true -> {<<>>, update_part_with_value(Acc, false, Part)};
                          false -> {Acc, Part}
                      end,
      % it into a part.
      get_next_line(Data1, Acc1, Part1, State1).
  
  
negative.code:             read_part_header(Data1, #part {}, State2);
          A when A == start_value orelse A == continue ->
              % Write the line, then continue...  
              Part2 =
              try
                  update_part_with_value(Line, true, Part1)
              catch
                  throw : Reason -> throw({Reason, State})
              end,
              read_part_value(Data1, Part2, State1);
          eof ->
              update_state_with_part(Part1, State1)
  