aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-05-23 14:40:16 +0200
committerLoïc Hoguin <[email protected]>2017-05-23 14:40:16 +0200
commit20f1ec02b0b1b4727b2c6e96a3b04e4785ff3228 (patch)
tree28e803a5b5809901e77a84380ec9a3bf6a4aea1a /src
parent0d5b36e1ba765c4aef84449e76c8ab8061074f96 (diff)
downloadcowlib-20f1ec02b0b1b4727b2c6e96a3b04e4785ff3228.tar.gz
cowlib-20f1ec02b0b1b4727b2c6e96a3b04e4785ff3228.tar.bz2
cowlib-20f1ec02b0b1b4727b2c6e96a3b04e4785ff3228.zip
Add building of PRIORITY frame
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;