@@ -236,9 +236,8 @@ handle_cast(Msg, #state{mod = #mod{config_db = Db} = ModData} = State) ->
236236% %--------------------------------------------------------------------
237237handle_info ({Proto , Socket , Data },
238238 # state {mfa = {Module , Function , Args },
239- chunk = {ChunkState , _ },
240239 mod = # mod {socket_type = SockType ,
241- socket = Socket } = ModData } = State )
240+ socket = Socket } = ModData } = State )
242241 when (((Proto =:= tcp ) orelse
243242 (Proto =:= ssl ) orelse
244243 (Proto =:= dummy )) andalso is_binary (Data )) ->
@@ -266,7 +265,7 @@ handle_info({Proto, Socket, Data},
266265 {stop , normal , State # state {response_sent = true ,
267266 mod = NewModData }};
268267 {error , {version_error , ErrCode , ErrStr }, Version } ->
269- NewModData = ModData # mod {http_version = Version },
268+ NewModData = ModData # mod {http_version = Version },
270269 httpd_response :send_status (NewModData , ErrCode , ErrStr ),
271270 {stop , normal , State # state {response_sent = true ,
272271 mod = NewModData }};
@@ -275,18 +274,15 @@ handle_info({Proto, Socket, Data},
275274 httpd_response :send_status (NewModData , ErrCode , ErrStr ),
276275 {stop , normal , State # state {response_sent = true ,
277276 mod = NewModData }};
277+ NewMFA ->
278+ setopts (Socket , SockType , [{active , once }]),
279+ case NewDataSize of
280+ undefined ->
281+ {noreply , State # state {mfa = NewMFA }};
282+ _ ->
283+ {noreply , State # state {mfa = NewMFA , data = NewDataSize }}
284+ end
278285
279- {http_chunk = Module , Function , Args } when ChunkState =/= undefined ->
280- NewState = handle_chunk (Module , Function , Args , State ),
281- {noreply , NewState };
282- NewMFA ->
283- setopts (Socket , SockType , [{active , once }]),
284- case NewDataSize of
285- undefined ->
286- {noreply , State # state {mfa = NewMFA }};
287- _ ->
288- {noreply , State # state {mfa = NewMFA , data = NewDataSize }}
289- end
290286 end ;
291287
292288% % Error cases
@@ -535,7 +531,6 @@ handle_body(#state{headers = Headers, body = Body,
535531 {stop , normal , State # state {response_sent = true }};
536532 _ ->
537533 Length = list_to_integer (Headers # http_request_h .'content-length' ),
538- MaxChunk = max_client_body_chunk (ConfigDB ),
539534 case Length =< MaxBodySize orelse MaxBodySize == nolimit of
540535 true ->
541536 case httpd_request :body_chunk_first (Body , Length , MaxChunk ) of
@@ -617,29 +612,6 @@ expect(Headers, _, ConfigDB) ->
617612 end
618613 end .
619614
620- handle_chunk (http_chunk = Module , decode_data = Function ,
621- [ChunkSize , TotalChunk , {MaxBodySize , BodySoFar , _AccLength , MaxHeaderSize }],
622- # state {chunk = {_ , CbState },
623- mod = # mod {socket_type = SockType ,
624- socket = Socket } = ModData } = State ) ->
625- {continue , NewCbState } = httpd_response :handle_continuation (ModData # mod {entity_body =
626- {continue , BodySoFar , CbState }}),
627- setopts (Socket , SockType , [{active , once }]),
628- State # state {chunk = {continue , NewCbState }, mfa = {Module , Function , [ChunkSize , TotalChunk , {MaxBodySize , <<>>, 0 , MaxHeaderSize }]}};
629-
630- handle_chunk (http_chunk = Module , decode_size = Function ,
631- [Data , HexList , _AccSize , {MaxBodySize , BodySoFar , _AccLength , MaxHeaderSize }],
632- # state {chunk = {_ , CbState },
633- mod = # mod {socket_type = SockType ,
634- socket = Socket } = ModData } = State ) ->
635- {continue , NewCbState } = httpd_response :handle_continuation (ModData # mod {entity_body = {continue , BodySoFar , CbState }}),
636- setopts (Socket , SockType , [{active , once }]),
637- State # state {chunk = {continue , NewCbState }, mfa = {Module , Function , [Data , HexList , 0 , {MaxBodySize , <<>>, 0 , MaxHeaderSize }]}};
638- handle_chunk (Module , Function , Args , # state {mod = # mod {socket_type = SockType ,
639- socket = Socket }} = State ) ->
640- setopts (Socket , SockType , [{active , once }]),
641- State # state {mfa = {Module , Function , Args }}.
642-
643615handle_internal_chunk (# state {chunk = {ChunkState , CbState }, body = Chunk ,
644616 mod = # mod {socket_type = SockType ,
645617 socket = Socket } = ModData } = State , Module , Function , Args )->
0 commit comments