|
@@ -128,8 +128,12 @@ fold([Response0={headers, _, Headers}|Tail], State0, Acc) ->
|
|
|
fold([Data0={data, _, _}|Tail], State0=#state{compress=gzip}, Acc) ->
|
|
|
{Data, State} = gzip_data(Data0, State0),
|
|
|
fold(Tail, State, [Data|Acc]);
|
|
|
-%% Otherwise, we either have an unrelated command, or a data command
|
|
|
-%% with compression disabled.
|
|
|
+%% When trailers are sent we need to end the compression.
|
|
|
+%% This results in an extra data command being sent.
|
|
|
+fold([Trailers={trailers, _}|Tail], State0=#state{compress=gzip}, Acc) ->
|
|
|
+ {{data, fin, Data}, State} = gzip_data({data, fin, <<>>}, State0),
|
|
|
+ fold(Tail, State, [Trailers, {data, nofin, Data}|Acc]);
|
|
|
+%% Otherwise, we have an unrelated command or compression is disabled.
|
|
|
fold([Command|Tail], State, Acc) ->
|
|
|
fold(Tail, State, [Command|Acc]).
|
|
|
|