aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cow_http2.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cow_http2.erl b/src/cow_http2.erl
index efc3ad8..ef7d439 100644
--- a/src/cow_http2.erl
+++ b/src/cow_http2.erl
@@ -23,6 +23,7 @@
-export([data/3]).
-export([data_header/3]).
-export([headers/3]).
+-export([priority/4]).
-export([rst_stream/2]).
-export([settings/1]).
-export([settings_payload/1]).
@@ -359,6 +360,10 @@ headers(StreamID, IsFin, HeaderBlock) ->
FlagEndHeaders = 1,
[<< Len:24, 1:8, 0:5, FlagEndHeaders:1, 0:1, FlagEndStream:1, 0:1, StreamID:31 >>, HeaderBlock].
+priority(StreamID, E, DepStreamID, Weight) ->
+ FlagExclusive = exclusive(E),
+ << 5:24, 2:8, 0:9, StreamID:31, FlagExclusive:1, DepStreamID:31, Weight:8 >>.
+
rst_stream(StreamID, Reason) ->
ErrorCode = error_code(Reason),
<< 4:24, 3:8, 0:9, StreamID:31, ErrorCode:32 >>.
@@ -400,6 +405,9 @@ window_update(StreamID, Increment) when Increment =< 16#7fffffff ->
flag_fin(nofin) -> 0;
flag_fin(fin) -> 1.
+exclusive(shared) -> 0;
+exclusive(exclusive) -> 1.
+
error_code(no_error) -> 0;
error_code(protocol_error) -> 1;
error_code(internal_error) -> 2;