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 2021/01/28 07:11:04 UTC

[GitHub] [couchdb] bessbd commented on a change in pull request #3340: Fix PUT of multipart/related attachments support for Transfer-Encoding: chunked

bessbd commented on a change in pull request #3340:
URL: https://github.com/apache/couchdb/pull/3340#discussion_r565863947



##########
File path: src/chttpd/src/chttpd_db.erl
##########
@@ -1242,6 +1242,14 @@ bulk_get_multipart_boundary() ->
 receive_request_data(Req) ->
     receive_request_data(Req, chttpd:body_length(Req)).
 
+receive_request_data(Req, Len) when Len == chunked ->
+    ChunkFun = fun({_Length, Binary}, _State) ->
+        self() ! {chunk, Req, Binary}

Review comment:
       Done in 9bd0e936e .
   
   > Was it done to match and assert later one that we only receive the message from the same request? 
   
   Yes. Adding `Req` (or a ref) should not be necessary, it's just more of a defensive programming precaution thing.
   
   > I wonder if we need to pass the `Req` object around here for every chunk read as it's quite large.
   
   I'm no erlang expert, but I thought since we're in the same process, this would be a reference passed anyway (and not a value / copy) so the size of `Req` would not matter.




----------------------------------------------------------------
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