anchor.diff:  %%      Will only receive up to the default max-body length
   do_recv_body(State=#state{reqdata=RD}) ->
       State#state{reqdata=wrq:set_req_body(
  -                             do_recv_body(State, ?MAX_RECV_BODY), RD)}.
  -
  -%% @doc Receive the body of the HTTP request (defined by Content-Length).
  -%%      Will receive up to MaxBody bytes. 
  -do_recv_body(State = #state{reqdata=RD}, MaxBody) ->
  +          read_whole_stream(do_stream_body(State, ?MAX_RECV_BODY), []), RD)}.
  +
  +read_whole_stream({Hunk,Next}, Acc0) ->
  +    Acc = [Hunk|Acc0],
  +    case Next of
  +        done -> iolist_to_binary(lists:reverse(Acc));
  +        _ -> read_whole_stream(Next(), Acc)
  +    end.
  +
  +do_stream_body(State = #state{reqdata=RD}, MaxHunkSize) ->
       case get_header_value("expect", State) of
   	{"100-continue", _} ->
   	    send(State#state.socket, 
  
positive.code: 	_Else ->
  	    ok
      end,
      Body = case body_length(State) of
                 undefined ->
                     undefined;
                 {unknown_transfer_encoding, Unknown} -> 
                     exit({unknown_transfer_encoding, Unknown});
                 0 ->
                     <<>>;
                 Length when is_integer(Length), Length =< MaxBody ->
                     recv(State, Length);
                 Length ->
                     exit({body_too_large, Length})
             end,
      Body.
  
  %% @spec recv(state(), integer()) -> binary()
  %% @doc Receive Length bytes from the client as a binary, with the default
  %%      idle timeout.
  recv(State, Length) -> recv(State, Length, ?IDLE_TIMEOUT).
  
  %% @spec recv(state(), integer(), integer()) -> binary()
  %% @doc Receive Length bytes from the client as a binary, with the given
  %%      Timeout in msec.
  recv(State, Length, Timeout) ->
      Socket = State#state.socket,
      case gen_tcp:recv(Socket, Length, Timeout) of
  	{ok, Data} ->
  	    Data;
  	_R ->
  	    io:format("got socket error ~p~n", [_R]),
  	    exit(normal)
      end.
  
  get_range(State) ->
  
negative.code:     case get_header_value("transfer-encoding", State) of
          {undefined, _} ->
              case get_header_value("content-length", State) of
                  {undefined, _} -> undefined;
                  {Length, _} -> list_to_integer(Length)
              end;
          {"chunked", _} -> chunked;
          Unknown -> {unknown_transfer_encoding, Unknown}
      end.
  
  %% @spec do_recv_body(state()) -> state()
  