diff options
author | Loïc Hoguin <[email protected]> | 2014-12-24 19:13:18 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-12-24 19:43:51 +0200 |
commit | 2d88bfa01064188549fa86f07a148f802d0f0d86 (patch) | |
tree | e6d558274c26b9da1863d04ad7bd35ba15d1917f | |
parent | 6e9476d9e37f8c1e9925f80cd267e312f09b48aa (diff) | |
download | cowlib-2d88bfa01064188549fa86f07a148f802d0f0d86.tar.gz cowlib-2d88bfa01064188549fa86f07a148f802d0f0d86.tar.bz2 cowlib-2d88bfa01064188549fa86f07a148f802d0f0d86.zip |
Add dummy functions for Sec-WebSocket-(Accept|Key) headers
From RFC6455.
These base64 values are expected to be matched directly in the
first case, or hashed to generate a new base64 value, therefore
no parsing or validation is required.
-rw-r--r-- | src/cow_http_hd.erl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl index 2daff5f..4ce59a2 100644 --- a/src/cow_http_hd.erl +++ b/src/cow_http_hd.erl @@ -34,7 +34,9 @@ -export([parse_if_unmodified_since/1]). -export([parse_last_modified/1]). -export([parse_max_forwards/1]). +-export([parse_sec_websocket_accept/1]). -export([parse_sec_websocket_extensions/1]). +-export([parse_sec_websocket_key/1]). -export([parse_sec_websocket_protocol_client/1]). -export([parse_sec_websocket_version_client/1]). -export([parse_te/1]). @@ -1792,6 +1794,16 @@ parse_max_forwards_error_test_() -> [{V, fun() -> {'EXIT', _} = (catch parse_content_length(V)) end} || V <- Tests]. -endif. +%% @doc Dummy parsing function for the Sec-WebSocket-Accept header. +%% +%% The argument is returned without any processing. This value is +%% expected to be matched directly by the client so no parsing is +%% needed. + +-spec parse_sec_websocket_accept(binary()) -> binary(). +parse_sec_websocket_accept(SecWebSocketAccept) -> + SecWebSocketAccept. + %% @doc Parse the Sec-WebSocket-Extensions request header. -spec parse_sec_websocket_extensions(binary()) -> [{binary(), [binary() | {binary(), binary()}]}]. @@ -1903,6 +1915,17 @@ horse_parse_sec_websocket_extensions() -> ). -endif. +%% @doc Dummy parsing function for the Sec-WebSocket-Key header. +%% +%% The argument is returned without any processing. This value is +%% expected to be prepended to a static value, the result of which +%% hashed to form a new base64 value returned in Sec-WebSocket-Accept, +%% therefore no parsing is needed. + +-spec parse_sec_websocket_key(binary()) -> binary(). +parse_sec_websocket_key(SecWebSocketKey) -> + SecWebSocketKey. + %% @doc Parse the Sec-WebSocket-Protocol request header. -spec parse_sec_websocket_protocol_client(binary()) -> [binary()]. |