You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/09/10 21:25:33 UTC

[GitHub] [couchdb] davisp commented on a change in pull request #3145: Fix buffer_response=true

davisp commented on a change in pull request #3145:
URL: https://github.com/apache/couchdb/pull/3145#discussion_r486642219



##########
File path: src/chttpd/src/chttpd.erl
##########
@@ -855,13 +855,19 @@ end_delayed_json_response(#delayed_resp{buffer_response=false}=DelayedResp) ->
 
 end_delayed_json_response(#delayed_resp{buffer_response=true}=DelayedResp) ->
     #delayed_resp{
+        start_fun = StartFun,
         req = Req,
         code = Code,
         headers = Headers,
         chunks = Chunks
     } = DelayedResp,
-    {ok, Resp} = start_response_length(Req, Code, Headers, iolist_size(Chunks)),
-    send(Resp, lists:reverse(Chunks)).
+    {ok, Resp} = StartFun(Req, Code, Headers),
+    lists:foreach(
+        fun
+            ("") -> ok;
+            (Chunk) -> send_chunk(Resp, Chunk)
+        end, lists:reverse(Chunks)),

Review comment:
       This formatting is kinda weird. Mebbe something like such?
   
   ```erlang
   lists:foreach(fun
       ([]) -> ok;
       (Chunk) -> send_chunk(Resp, Chunk)
   end, lists:reverse(Chunks)),
   ```
   
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org