anchor.diff:              ?DEFAULT_STRING
           ]
       ).
  +
  +large_response(Module, Socket, _, _, _) ->
  +    BodyPart = <<?LONG_BODY_PART>>,
  +    ContentLength = 3 * size(BodyPart),
  +    Module:send(
  +        Socket,
  +        [
  +            "HTTP/1.1 200 OK\r\n"
  +            "Content-type: text/plain\r\n"
  +            "Content-length: ", integer_to_list(ContentLength), "\r\n\r\n"
  +        ]
  +    ),
  +    Module:send(Socket, BodyPart),
  +    Module:send(Socket, BodyPart),
  +    Module:send(Socket, BodyPart).
  +
  +large_chunked_response(Module, Socket, _, _, _) ->
  +    BodyPart = <<?LONG_BODY_PART>>,
  +    ChunkSize = erlang:integer_to_list(size(BodyPart), 16),
  +    Chunk = [ChunkSize, "\r\n", BodyPart, "\r\n"],
  +    Module:send(
  +        Socket,
  +        [
  +            "HTTP/1.1 200 OK\r\n"
  +            "Content-type: text/plain\r\n"
  +            "Transfer-Encoding: chunked\r\n\r\n"
  +        ]
  +    ),
  +    Module:send(Socket, Chunk),
  +    Module:send(Socket, Chunk),
  +    Module:send(Socket, Chunk),
  +    Module:send(Socket, "0\r\n\r\n").
   
   chunked_upload(Module, Socket, _, Headers, <<>>) ->
       TransferEncoding = lhttpc_lib:header_value("transfer-encoding", Headers),
  
positive.code: -include_lib("eunit/include/eunit.hrl").
  
  -define(DEFAULT_STRING, "Great success!").
  
  test_no(N, Tests) ->
  	setelement(4, Tests, lists:nth(N, element(4, Tests))).
  
negative.code:     ?assertEqual(element(2, Trailer), 
          lhttpc_lib:header_value("x-test-orig-trailer-1", headers(Response2))).
  
  partial_download_identity() ->
      Port = start(gen_tcp, [fun large_response/5]),
      URL = url(Port, "/partial_download_identity"),
      PartialDownload = [
          {window_size, 1},
          {receiver, self()}
      ],
      Options = [{partial_download, PartialDownload}],
      {ok, {Status, _, Pid}} =
          lhttpc:request(URL, get, [], <<>>, 1000, Options),
      Body = read_partial_body(Pid),
      ?assertEqual({200, "OK"}, Status),
      ?assertEqual(<<?LONG_BODY_PART ?LONG_BODY_PART ?LONG_BODY_PART>>, Body).
  
  limited_partial_download_identity() ->
      Port = start(gen_tcp, [fun large_response/5]),
      URL = url(Port, "/partial_download_identity"),
      PartialDownload = [
          {window_size, 1},
          {receiver, self()},
          {part_size, 512} % bytes
      ],
      Options = [{partial_download, PartialDownload}],
      {ok, {Status, _, Pid}} =
          lhttpc:request(URL, get, [], <<>>, 1000, Options),
      Body = read_partial_body(Pid, 512),
      ?assertEqual({200, "OK"}, Status),
      ?assertEqual(<<?LONG_BODY_PART ?LONG_BODY_PART ?LONG_BODY_PART>>, Body).
  
  partial_download_chunked() ->
      Port = start(gen_tcp, [fun large_chunked_response/5]),
      URL = url(Port, "/partial_download_identity"),
      PartialDownload = [
          {window_size, 1},
          {receiver, self()}
      ],
      Options = [{partial_download, PartialDownload}],
      {ok, {Status, _, Pid}} =
          lhttpc:request(URL, get, [], <<>>, 1000, Options),
      Body = read_partial_body(Pid),
      ?assertEqual({200, "OK"}, Status),
      ?assertEqual(<<?LONG_BODY_PART ?LONG_BODY_PART ?LONG_BODY_PART>>, Body).
  
  close_connection() ->
      Port = start(gen_tcp, [fun close_connection/5]),
      URL = url(Port, "/close"),
  