anchor.diff:          Doc -> [{doc, Doc}]
       end,
       try couch_query_servers:proc_prompt(Proc, [<<"list_row">>, {RowObj}]) of
  +    [<<"chunks">>, Chunk, Headers] ->
  +        Acc2 = send_non_empty_chunk(fixup_headers(Headers, Acc), Chunk),
  +        {ok, Acc2};
       [<<"chunks">>, Chunk] ->
  -        send_non_empty_chunk(Resp, Chunk),
  -        {ok, Acc};
  +        Acc2 = send_non_empty_chunk(Acc, Chunk),
  +        {ok, Acc2};
  +    [<<"end">>, Chunk, Headers] ->
  +        Acc2 = send_non_empty_chunk(fixup_headers(Headers, Acc), Chunk),
  +        #lacc{resp = Resp2} = Acc2,
  +        couch_httpd:last_chunk(Resp2),
  +        {stop, Acc2};
       [<<"end">>, Chunk] ->
  -        send_non_empty_chunk(Resp, Chunk),
  -        couch_httpd:last_chunk(Resp),
  -        {stop, Acc}
  +        Acc2 = send_non_empty_chunk(Acc, Chunk),
  +        #lacc{resp = Resp2} = Acc2,
  +        couch_httpd:last_chunk(Resp2),
  +        {stop, Acc2}
       catch Error ->
  -        couch_httpd:send_chunked_error(Resp, Error),
  -        {stop, Acc}
  +        case Resp of
  +            undefined ->
  +                {Code, _, _} = couch_httpd:error_info(Error),
  +                #lacc{req=Req, headers=Headers} = Acc,
  +                {ok, Resp2} = couch_httpd:start_chunked_response(Req, Code, Headers),
  +                Acc2 = Acc#lacc{resp=Resp2, code=Code};
  +            _ -> Resp2 = Resp, Acc2 = Acc
  +        end,
  +        couch_httpd:send_chunked_error(Resp2, Error),
  +        {stop, Acc2}
       end.
   
  -send_non_empty_chunk(_, []) ->
  -    ok;
  -send_non_empty_chunk(Resp, Chunk) ->
  -    couch_httpd:send_chunk(Resp, Chunk).
  +send_non_empty_chunk(Acc, []) ->
  +    Acc;
  +send_non_empty_chunk(#lacc{resp=undefined} = Acc, Chunk) ->
  +    #lacc{req=Req, code=Code, headers=Headers} = Acc,
  +    {ok, Resp} = couch_httpd:start_chunked_response(Req, Code, Headers),
  +    send_non_empty_chunk(Acc#lacc{resp = Resp}, Chunk);
  +send_non_empty_chunk(#lacc{resp=Resp} = Acc, Chunk) ->
  +    couch_httpd:send_chunk(Resp, Chunk),
  +    Acc.
   
   
   apply_etag({ExternalResponse}, CurrentEtag) ->
  
positive.code:     true ->
          Resp = Resp0
      end,
      [<<"end">>, Data] = couch_query_servers:proc_prompt(Proc, [<<"list_end">>]),
      send_non_empty_chunk(Resp, Data),
      couch_httpd:last_chunk(Resp),
      {ok, Resp}.
  
  start_list_resp(Head, Acc) ->
      #lacc{db=Db, req=Req, qserver=QServer, lname=LName, etag=ETag} = Acc,
  
negative.code:     end).
  
  
  list_cb({meta, Meta}, #lacc{code=undefined} = Acc) ->
      MetaProps = case couch_util:get_value(total, Meta) of
          undefined -> [];
          Total -> [{total_rows, Total}]
  