You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wi...@apache.org on 2020/01/10 08:13:05 UTC

[couchdb-mochiweb] 08/32: Remove compile(tuple_calls) from mochiweb_multipart

This is an automated email from the ASF dual-hosted git repository.

willholley pushed a commit to branch upstream-2.20.0
in repository https://gitbox.apache.org/repos/asf/couchdb-mochiweb.git

commit 6f9452c0d83c5478f250b8d922f3bb0638edb947
Author: Bob Ippolito <bo...@redivi.com>
AuthorDate: Sat Mar 9 20:47:44 2019 +0000

    Remove compile(tuple_calls) from mochiweb_multipart
---
 src/mochiweb_multipart.erl | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mochiweb_multipart.erl b/src/mochiweb_multipart.erl
index 6f611c0..46b7090 100644
--- a/src/mochiweb_multipart.erl
+++ b/src/mochiweb_multipart.erl
@@ -24,8 +24,6 @@
 -module(mochiweb_multipart).
 -author('bob@mochimedia.com').
 
--compile(tuple_calls).
-
 -export([parse_form/1, parse_form/2]).
 -export([parse_multipart_request/2]).
 -export([parts_to_body/3, parts_to_multipart_body/4]).
@@ -146,11 +144,11 @@ default_file_handler_1(Filename, ContentType, Acc) ->
             default_file_handler_1(Filename, ContentType, [Next | Acc])
     end.
 
-parse_multipart_request(Req, Callback) ->
+parse_multipart_request({ReqM, _} = Req, Callback) ->
     %% TODO: Support chunked?
-    Length = list_to_integer(Req:get_combined_header_value("content-length")),
+    Length = list_to_integer(ReqM:get_combined_header_value("content-length", Req)),
     Boundary = iolist_to_binary(
-                 get_boundary(Req:get_header_value("content-type"))),
+                 get_boundary(ReqM:get_header_value("content-type", Req))),
     Prefix = <<"\r\n--", Boundary/binary>>,
     BS = byte_size(Boundary),
     Chunk = read_chunk(Req, Length),
@@ -182,12 +180,12 @@ split_header(Line) ->
     {string:to_lower(string:strip(Name)),
      mochiweb_util:parse_header(Value)}.
 
-read_chunk(Req, Length) when Length > 0 ->
+read_chunk({ReqM, _} = Req, Length) when Length > 0 ->
     case Length of
         Length when Length < ?CHUNKSIZE ->
-            Req:recv(Length);
+            ReqM:recv(Length, Req);
         _ ->
-            Req:recv(?CHUNKSIZE)
+            ReqM:recv(?CHUNKSIZE, Req)
     end.
 
 read_more(State=#mp{length=Length, buffer=Buffer, req=Req}) ->