anchor.diff:      MP#mp{headers=Headers}.
   
   parse_headers(<<"\r\n", Raw/binary>>) ->
  -    [parse_header(Part) || Part <- split_headers(Raw)].
  +    [parse_header(Part) || Part <- split_headers(Raw)];
  +parse_headers(_) -> [].
   
   split_headers(Raw) ->
       binary:split(Raw, <<"\r\n">>, [global]).
   
   parse_header(Raw) ->
       case binary:split(Raw, <<":">>) of
  -        [Name, RawVal] -> {Name, header_val(RawVal)};
  -        [Name] -> {Name, <<>>}
  +        [Name, RawVal] -> {binary_to_list(Name), header_val(RawVal)};
  +        [Name] -> {binary_to_list(Name), <<>>}
       end.
   
  -header_val(<<" ", Val/binary>>) -> Val;
  -header_val(Val) -> Val.
  +header_val(<<" ", Val/binary>>) -> binary_to_list(Val);
  +header_val(Val) -> binary_to_list(Val).
  +
  +start_body(Data, MP) -> MP#mp{acc=[Data]}.
   
   add_cur(#mp{headers=Headers, acc=Acc, parts=Parts}=MP) ->
  -    Part = {Headers, finalize_body(Acc)},
  +    Name = form_data_name(Headers),
  +    Body = finalize_body(Acc),
  +    Part = {Name, Headers, Body},
       MP#mp{parts=[Part|Parts], headers=pending, acc=[]}.
   
  -start_body(Data, MP) -> MP#mp{acc=[Data]}.
  +-define(FORM_DATA_NAME_RE, <<"form-data; *name=\"(.*?)\"">>).
  +
  +form_data_name(Headers) ->
  +    Disp = proplists:get_value("Content-Disposition", Headers, ""),
  +    handle_form_data_name_re(
  +      re:run(Disp, ?FORM_DATA_NAME_RE, [{capture, [1], list}])).
  +
  +handle_form_data_name_re({match, [Name]}) -> Name;
  +handle_form_data_name_re(nomatch) -> <<>>.
   
   finalize_body([]) -> <<>>;
   finalize_body([Last|Rest]) ->
  
positive.code: -module(psycho_multipart).
  
  -export([new/3, data/2, form_data/1]).
  
  -record(mp, {boundary_delim, parts, headers, acc}).
  
  new(Boundary, _Callback, _Data) when is_binary(Boundary) ->
      #mp{
         boundary_delim=boundary_delim(Boundary),
         parts=[],
  
negative.code: data(Data, MP) ->
      try_boundary(Data, MP).
  
  try_boundary(Data, #mp{boundary_delim=Delim}=MP) ->
      Window = search_window(Data, MP),
      handle_boundary_match(binary:match(Window, Delim), Window, Data, MP).
  
  search_window(Data, #mp{acc=[]}) -> Data;
  search_window(Data, #mp{acc=[Last|_]}) -> join(Last, Data).
  
  join(B1, B2) -> <<B1/binary, B2/binary>>.
  
  handle_boundary_match(nomatch, Window, Data, MP) ->
      try_headers(Window, Data, MP);
  