From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 12 Mar 2016 18:10:32 +0100 Subject: [PATCH] Add settings_payload/1, settings_ack/0 and ping/1 in cow_http2 Although settings_payload/1 is currently only a placeholder. 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 >>.