diff options
author | Loïc Hoguin <[email protected]> | 2018-04-06 17:39:07 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-04-06 17:39:07 +0200 |
commit | ab37df9d5273ea8541dbc08f2bd0d00e1b83479a (patch) | |
tree | 5883e34b55fa29af67396d28be45443899210f5c /src/cow_http2.erl | |
parent | b6381527831c5ebb74759e119a517b7d22d4b23a (diff) | |
download | cowlib-ab37df9d5273ea8541dbc08f2bd0d00e1b83479a.tar.gz cowlib-ab37df9d5273ea8541dbc08f2bd0d00e1b83479a.tar.bz2 cowlib-ab37df9d5273ea8541dbc08f2bd0d00e1b83479a.zip |
Add the enable_connect_protocol HTTP/2 setting
Diffstat (limited to 'src/cow_http2.erl')
-rw-r--r-- | src/cow_http2.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cow_http2.erl b/src/cow_http2.erl index 07d09c8..29b2dce 100644 --- a/src/cow_http2.erl +++ b/src/cow_http2.erl @@ -340,6 +340,14 @@ parse_settings_payload(<< 5:16, _:32, _/bits >>, _, _) -> %% SETTINGS_MAX_HEADER_LIST_SIZE. parse_settings_payload(<< 6:16, Value:32, Rest/bits >>, Len, Settings) -> parse_settings_payload(Rest, Len - 6, Settings#{max_header_list_size => Value}); +%% SETTINGS_ENABLE_CONNECT_PROTOCOL. +parse_settings_payload(<< 8:16, 0:32, Rest/bits >>, Len, Settings) -> + parse_settings_payload(Rest, Len - 6, Settings#{enable_connect_protocol => false}); +parse_settings_payload(<< 8:16, 1:32, Rest/bits >>, Len, Settings) -> + parse_settings_payload(Rest, Len - 6, Settings#{enable_connect_protocol => true}); +parse_settings_payload(<< 8:16, _:32, _/bits >>, _, _) -> + {connection_error, protocol_error, 'The SETTINGS_ENABLE_CONNECT_PROTOCOL value MUST be 0 or 1. (draft-h2-websockets-01 3)'}; +%% Ignore unknown settings. parse_settings_payload(<< _:48, Rest/bits >>, Len, Settings) -> parse_settings_payload(Rest, Len - 6, Settings). @@ -380,7 +388,9 @@ settings_payload(Settings) -> max_concurrent_streams -> <<3:16, Value:32>>; initial_window_size -> <<4:16, Value:32>>; max_frame_size -> <<5:16, Value:32>>; - max_header_list_size -> <<6:16, Value:32>> + max_header_list_size -> <<6:16, Value:32>>; + enable_connect_protocol when Value -> <<8:16, 1:32>>; + enable_connect_protocol -> <<8:16, 0:32>> end || {Key, Value} <- maps:to_list(Settings)]. settings_ack() -> |