anchor.diff:      request(Socket, Body).
   
   request(Socket, Body) ->
  -    case mochiweb_socket:recv(Socket, 0, ?REQUEST_RECV_TIMEOUT) of
  -        {ok, {http_request, Method, Path, Version}} ->
  +    mochiweb_socket:setopts(Socket, [{active, once}]),
  +    receive
  +        {Protocol, _, {http_request, Method, Path, Version}} when Protocol == http orelse Protocol == ssl ->
               mochiweb_socket:setopts(Socket, [{packet, httph}]),
               headers(Socket, {Method, Path, Version}, [], Body, 0);
  -        {error, {http_error, "\r\n"}} ->
  +        {Protocol, _, {http_error, "\r\n"}} when Protocol == http orelse Protocol == ssl ->
               request(Socket, Body);
  -        {error, {http_error, "\n"}} ->
  +        {Protocol, _, {http_error, "\n"}} when Protocol == http orelse Protocol == ssl ->
               request(Socket, Body);
  -        {error, closed} ->
  -            mochiweb_socket:close(Socket),
  -            exit(normal);
  -        {error, timeout} ->
  +        {tcp_closed, _} ->
               mochiweb_socket:close(Socket),
               exit(normal);
           _Other ->
               handle_invalid_request(Socket)
  +    after ?REQUEST_RECV_TIMEOUT ->
  +        mochiweb_socket:close(Socket),
  +        exit(normal)
       end.
   
   reentry(Body) ->
  
positive.code:     mochiweb_socket:setopts(Socket, [{packet, raw}]),
      handle_invalid_request(Socket, Request, Headers);
  headers(Socket, Request, Headers, Body, HeaderCount) ->
      case mochiweb_socket:recv(Socket, 0, ?HEADERS_RECV_TIMEOUT) of
          {ok, http_eoh} ->
              mochiweb_socket:setopts(Socket, [{packet, raw}]),
              Req = mochiweb:new_request({Socket, Request,
                                          lists:reverse(Headers)}),
              call_body(Body, Req),
              ?MODULE:after_response(Body, Req);
          {ok, {http_header, _, Name, _, Value}} ->
              headers(Socket, Request, [{Name, Value} | Headers], Body,
                      1 + HeaderCount);
          {error, closed} ->
              mochiweb_socket:close(Socket),
              exit(normal);
          _Other ->
              handle_invalid_request(Socket, Request, Headers)
      end.
  
  call_body({M, F}, Req) ->
  
negative.code:     handle_invalid_request(Socket, {'GET', {abs_path, "/"}, {0,9}}, []).
  
  handle_invalid_request(Socket, Request, RevHeaders) ->
      Req = new_request(Socket, Request, RevHeaders),
      Req:respond({400, [], []}),
      mochiweb_socket:close(Socket),
      exit(normal).
  
  new_request(Socket, Request, RevHeaders) ->
      mochiweb_socket:setopts(Socket, [{packet, raw}]),
      mochiweb:new_request({Socket, Request, lists:reverse(RevHeaders)}).
  
  after_response(Body, Req) ->
      Socket = Req:get(socket),
  