anchor.diff:  headers(Socket, Request, Headers, _Body, ?MAX_HEADERS) ->
       %% Too many headers sent, bad request.
       inet:setopts(Socket, [{packet, raw}]),
  -    Req = mochiweb:new_request({Socket, Request,
  -                                lists:reverse(Headers)}),
  -    Req:respond({400, [], []}),
  -    gen_tcp:close(Socket),
  -    exit(normal);
  +    handle_invalid_request(Socket, Request, Headers);
   headers(Socket, Request, Headers, Body, HeaderCount) ->
       case gen_tcp:recv(Socket, 0, ?IDLE_TIMEOUT) of
           {ok, http_eoh} ->
  
positive.code:         {ok, {http_header, _, Name, _, Value}} ->
              headers(Socket, Request, [{Name, Value} | Headers], Body,
                      1 + HeaderCount);
          _Other ->
              gen_tcp:close(Socket),
              exit(normal)
      end.
  
  after_response(Body, Req) ->
      Socket = Req:get(socket),
  
negative.code:             request(Socket, Body);
          {error, {http_error, "\n"}} ->
              request(Socket, Body);
          {error, closed} ->
              gen_tcp:close(Socket),
              exit(normal);
          _Other ->
              handle_invalid_request(Socket)
      end.
  
  reentry(Body) ->
  