From 0d5b36e1ba765c4aef84449e76c8ab8061074f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 19 May 2017 16:42:37 +0200 Subject: Add functions for creating WINDOW_UPDATE h2 frames --- src/cow_http2.erl | 8 ++++++++ src/cow_multipart.erl | 1 + 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/cow_http2.erl b/src/cow_http2.erl index 460e6f1..efc3ad8 100644 --- a/src/cow_http2.erl +++ b/src/cow_http2.erl @@ -31,6 +31,8 @@ -export([ping/1]). -export([ping_ack/1]). -export([goaway/3]). +-export([window_update/1]). +-export([window_update/2]). -type streamid() :: pos_integer(). -type fin() :: fin | nofin. @@ -389,6 +391,12 @@ goaway(LastStreamID, Reason, DebugData) -> Len = iolist_size(DebugData) + 8, [<< Len:24, 7:8, 0:41, LastStreamID:31, ErrorCode:32 >>, DebugData]. +window_update(Increment) -> + window_update(0, Increment). + +window_update(StreamID, Increment) when Increment =< 16#7fffffff -> + << 4:24, 8:8, 0:8, StreamID:32, 0:1, Increment:31 >>. + flag_fin(nofin) -> 0; flag_fin(fin) -> 1. diff --git a/src/cow_multipart.erl b/src/cow_multipart.erl index 3cbef56..e86afcc 100644 --- a/src/cow_multipart.erl +++ b/src/cow_multipart.erl @@ -538,6 +538,7 @@ form_data(Headers) -> false -> <<"text/plain">>; {_, T} -> T end, + %% @todo Turns out this is unnecessary per RFC7578 4.7. TransferEncoding = case lists:keyfind( <<"content-transfer-encoding">>, 1, Headers) of false -> <<"7bit">>; -- cgit v1.2.3