mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Move body length count to cowboy_stream_h instead of protocols
The documentation was correct, the code was not. This should make it easier to implement new protocols. Note that for HTTP/2 we will need to add some form of counting later on to check for malformed requests, but we can do simpler and just reduce from the expected length and then check if that's 0 when IsFin=fin.
This commit is contained in:
parent
a6126306a2
commit
c09b10190b
4 changed files with 48 additions and 37 deletions
|
@ -440,7 +440,7 @@ read_body(Req=#{pid := Pid, streamid := StreamID}, Opts) ->
|
|||
receive
|
||||
{request_body, Ref, nofin, Body} ->
|
||||
{more, Body, Req};
|
||||
{request_body, Ref, {fin, BodyLength}, Body} ->
|
||||
{request_body, Ref, fin, BodyLength, Body} ->
|
||||
{ok, Body, set_body_length(Req, BodyLength)}
|
||||
after Timeout ->
|
||||
exit(timeout)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue