anchor.diff:              exit(normal)
       end.
   
  +reentry(Body) ->
  +    fun (Req) ->
  +            ?MODULE:after_response(Body, Req)
  +    end.
  +
   headers(Socket, Request, Headers, _Body, ?MAX_HEADERS) ->
       %% Too many headers sent, bad request.
       inet:setopts(Socket, [{packet, raw}]),
  
positive.code:             Req = mochiweb:new_request({Socket, Request,
                                          lists:reverse(Headers)}),
              Body(Req),
              case Req:should_close() of
                  true ->
                      gen_tcp:close(Socket),
                      exit(normal);
                  false ->
                      Req:cleanup(),
                      ?MODULE:loop(Socket, Body)
              end;
          {ok, {http_header, _, Name, _, Value}} ->
              headers(Socket, Request, [{Name, Value} | Headers], Body,
                      1 + HeaderCount);
  
negative.code:             gen_tcp:close(Socket),
              exit(normal)
      end.
  
  after_response(Body, Req) ->
      Socket = Req:get(socket),
      case Req:should_close() of
          true ->
              gen_tcp:close(Socket),
              exit(normal);
          false ->
              Req:cleanup(),
              ?MODULE:loop(Socket, Body)
      end.
  