aboutsummaryrefslogtreecommitdiffstats
path: root/src/cow_http2.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-03-12 18:10:32 +0100
committerLoïc Hoguin <[email protected]>2016-03-12 18:10:32 +0100
commit70b696808217f112d77ca30da9f2717427db7a3f (patch)
tree194244dcc27012a91428986543d70a38b22c561d /src/cow_http2.erl
parente6f58727a74e36e3fdfc4e13e5f4b91b9c167b4b (diff)
downloadcowlib-70b696808217f112d77ca30da9f2717427db7a3f.tar.gz
cowlib-70b696808217f112d77ca30da9f2717427db7a3f.tar.bz2
cowlib-70b696808217f112d77ca30da9f2717427db7a3f.zip
Add settings_payload/1, settings_ack/0 and ping/1 in cow_http2
Although settings_payload/1 is currently only a placeholder.
Diffstat (limited to 'src/cow_http2.erl')
-rw-r--r--src/cow_http2.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cow_http2.erl b/src/cow_http2.erl
index c7773b4..163802e 100644
--- a/src/cow_http2.erl
+++ b/src/cow_http2.erl
@@ -22,7 +22,10 @@
-export([headers/3]).
-export([rst_stream/2]).
-export([settings/1]).
+-export([settings_payload/1]).
+-export([settings_ack/0]).
-export([push_promise/3]).
+-export([ping/1]).
-export([ping_ack/1]).
-type streamid() :: pos_integer().
@@ -309,12 +312,22 @@ rst_stream(StreamID, Reason) ->
settings(#{}) ->
<< 0:24, 4:8, 0:40 >>.
+%% @todo Actually implement it. :-)
+settings_payload(#{}) ->
+ <<>>.
+
+settings_ack() ->
+ << 0:24, 4:8, 1:8, 0:32 >>.
+
%% @todo Check size of HeaderBlock and use CONTINUATION frames if needed.
push_promise(StreamID, PromisedStreamID, HeaderBlock) ->
Len = iolist_size(HeaderBlock) + 4,
FlagEndHeaders = 1,
[<< Len:24, 5:8, 0:5, FlagEndHeaders:1, 0:3, StreamID:31, 0:1, PromisedStreamID:31 >>, HeaderBlock].
+ping(Opaque) ->
+ << 8:24, 6:8, 0:40, Opaque:64 >>.
+
ping_ack(Opaque) ->
<< 8:24, 6:8, 0:7, 1:1, 0:32, Opaque:64 >>.