aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http2.erl
diff options
context:
space:
mode:
authorTony Han <[email protected]>2019-04-28 10:46:17 +0800
committerLoïc Hoguin <[email protected]>2019-07-16 15:32:58 +0200
commit7708fc77cd95768aef65bd0eb366ee300cc0515f (patch)
tree82be19d508355a71d0cc4a697a23c80edf2e0ab0 /src/cowboy_http2.erl
parent504c7c55f7962474c3d6251172810c7731f8d7b0 (diff)
downloadcowboy-7708fc77cd95768aef65bd0eb366ee300cc0515f.tar.gz
cowboy-7708fc77cd95768aef65bd0eb366ee300cc0515f.tar.bz2
cowboy-7708fc77cd95768aef65bd0eb366ee300cc0515f.zip
Data received after RST_STREAM counts toward window
Diffstat (limited to 'src/cowboy_http2.erl')
-rw-r--r--src/cowboy_http2.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl
index d6f80e6..36aea0c 100644
--- a/src/cowboy_http2.erl
+++ b/src/cowboy_http2.erl
@@ -255,6 +255,8 @@ frame(State=#state{http2_machine=HTTP2Machine0}, Frame) ->
maybe_ack(State#state{http2_machine=HTTP2Machine}, Frame);
{ok, {data, StreamID, IsFin, Data}, HTTP2Machine} ->
data_frame(State#state{http2_machine=HTTP2Machine}, StreamID, IsFin, Data);
+ {ok, {lingering_data, _StreamID, DataLen}, HTTP2Machine} ->
+ lingering_data_frame(State#state{http2_machine=HTTP2Machine}, DataLen);
{ok, {headers, StreamID, IsFin, Headers, PseudoHeaders, BodyLen}, HTTP2Machine} ->
headers_frame(State#state{http2_machine=HTTP2Machine},
StreamID, IsFin, Headers, PseudoHeaders, BodyLen);
@@ -306,6 +308,12 @@ data_frame(State=#state{opts=Opts, streams=Streams}, StreamID, IsFin, Data) ->
State
end.
+lingering_data_frame(State=#state{socket=Socket, transport=Transport,
+ http2_machine=HTTP2Machine0}, DataLen) ->
+ Transport:send(Socket, cow_http2:window_update(DataLen)),
+ HTTP2Machine1 = cow_http2_machine:update_window(DataLen, HTTP2Machine0),
+ State#state{http2_machine=HTTP2Machine1}.
+
headers_frame(State, StreamID, IsFin, Headers,
PseudoHeaders=#{method := <<"CONNECT">>}, _)
when map_size(PseudoHeaders) =:= 2 ->